@desynova-digital/player 3.13.20 → 3.13.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Shortcut.js +64 -53
- package/package.json +1 -1
package/components/Shortcut.js
CHANGED
|
@@ -12,10 +12,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
12
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
15
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
16
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
23
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
24
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
21
25
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -55,6 +59,37 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
55
59
|
var _this;
|
|
56
60
|
_classCallCheck(this, Shortcut);
|
|
57
61
|
_this = _callSuper(this, Shortcut, [props, context]);
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "segmentShift", function (direction) {
|
|
63
|
+
var _this$props = _this.props,
|
|
64
|
+
leftMarker = _this$props.playerSelectedMarker.leftMarker,
|
|
65
|
+
onTagClick = _this$props.onTagClick;
|
|
66
|
+
var _this$props2 = _this.props,
|
|
67
|
+
actions = _this$props2.actions,
|
|
68
|
+
_this$props2$markers = _slicedToArray(_this$props2.markers, 1),
|
|
69
|
+
values = _this$props2$markers[0].values;
|
|
70
|
+
var newIndex;
|
|
71
|
+
if (direction === 'backward') {
|
|
72
|
+
newIndex = values.findIndex(function (item) {
|
|
73
|
+
return item.in_time === leftMarker;
|
|
74
|
+
}) - 1;
|
|
75
|
+
}
|
|
76
|
+
if (direction === 'forward') {
|
|
77
|
+
newIndex = values.findIndex(function (item) {
|
|
78
|
+
return item.in_time === leftMarker;
|
|
79
|
+
}) + 1;
|
|
80
|
+
}
|
|
81
|
+
if (leftMarker > -1 && newIndex < values.length && direction === 'forward' || leftMarker > -1 && newIndex > -1 && direction === 'backward') {
|
|
82
|
+
var _values$newIndex, _values$newIndex2, _values$newIndex3;
|
|
83
|
+
actions.seek((_values$newIndex = values[newIndex]) === null || _values$newIndex === void 0 ? void 0 : _values$newIndex.start_time);
|
|
84
|
+
onTagClick((_values$newIndex2 = values[newIndex]) === null || _values$newIndex2 === void 0 ? void 0 : _values$newIndex2.start_time, (_values$newIndex3 = values[newIndex]) === null || _values$newIndex3 === void 0 ? void 0 : _values$newIndex3.end_time, values[newIndex]);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
_defineProperty(_assertThisInitialized(_this), "debounceSegmentShiftForward", (0, _lodash.debounce)(function () {
|
|
88
|
+
_this.segmentShift('forward');
|
|
89
|
+
}, 0));
|
|
90
|
+
_defineProperty(_assertThisInitialized(_this), "debounceSegmentShiftBackward", (0, _lodash.debounce)(function () {
|
|
91
|
+
_this.segmentShift('backward');
|
|
92
|
+
}, 0));
|
|
58
93
|
_defineProperty(_assertThisInitialized(_this), "debounceKeyFunc", (0, _lodash.debounce)(function (keyCode) {
|
|
59
94
|
_this.handleKeyMovement(keyCode);
|
|
60
95
|
}));
|
|
@@ -97,9 +132,9 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
97
132
|
* Once we leave the keyCombo isCalled variable is set to false. This ensures that on the next combo press we will again execute Q/W key combo first.
|
|
98
133
|
*/
|
|
99
134
|
_defineProperty(_assertThisInitialized(_this), "createThreeKeyCombo", function (event, handleKeyMovement, debounceKeyFunc, keyParameter) {
|
|
100
|
-
var _this$
|
|
101
|
-
playerReadOnlyMode = _this$
|
|
102
|
-
disablePlayerActions = _this$
|
|
135
|
+
var _this$props3 = _this.props,
|
|
136
|
+
playerReadOnlyMode = _this$props3.playerReadOnlyMode,
|
|
137
|
+
disablePlayerActions = _this$props3.disablePlayerActions;
|
|
103
138
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
104
139
|
return;
|
|
105
140
|
}
|
|
@@ -250,13 +285,13 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
250
285
|
keyCode: 73,
|
|
251
286
|
// I Key
|
|
252
287
|
handle: function handle(player, actions) {
|
|
253
|
-
var _this$
|
|
254
|
-
markers = _this$
|
|
255
|
-
playerType = _this$
|
|
256
|
-
onAddMarker = _this$
|
|
257
|
-
playerReadOnlyMode = _this$
|
|
258
|
-
disablePlayerActions = _this$
|
|
259
|
-
playerSelectedMarker = _this$
|
|
288
|
+
var _this$props4 = _this.props,
|
|
289
|
+
markers = _this$props4.markers,
|
|
290
|
+
playerType = _this$props4.playerType,
|
|
291
|
+
onAddMarker = _this$props4.onAddMarker,
|
|
292
|
+
playerReadOnlyMode = _this$props4.playerReadOnlyMode,
|
|
293
|
+
disablePlayerActions = _this$props4.disablePlayerActions,
|
|
294
|
+
playerSelectedMarker = _this$props4.playerSelectedMarker;
|
|
260
295
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
261
296
|
return;
|
|
262
297
|
}
|
|
@@ -310,14 +345,14 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
310
345
|
keyCode: 79,
|
|
311
346
|
// O Key
|
|
312
347
|
handle: function handle(player, actions) {
|
|
313
|
-
var _this$
|
|
314
|
-
markers = _this$
|
|
315
|
-
onMarkerSelect = _this$
|
|
316
|
-
playerType = _this$
|
|
317
|
-
onAddMarker = _this$
|
|
318
|
-
playerReadOnlyMode = _this$
|
|
319
|
-
disablePlayerActions = _this$
|
|
320
|
-
playerSelectedMarker = _this$
|
|
348
|
+
var _this$props5 = _this.props,
|
|
349
|
+
markers = _this$props5.markers,
|
|
350
|
+
onMarkerSelect = _this$props5.onMarkerSelect,
|
|
351
|
+
playerType = _this$props5.playerType,
|
|
352
|
+
onAddMarker = _this$props5.onAddMarker,
|
|
353
|
+
playerReadOnlyMode = _this$props5.playerReadOnlyMode,
|
|
354
|
+
disablePlayerActions = _this$props5.disablePlayerActions,
|
|
355
|
+
playerSelectedMarker = _this$props5.playerSelectedMarker;
|
|
321
356
|
if (playerReadOnlyMode || disablePlayerActions.includes('marking_controls')) {
|
|
322
357
|
return;
|
|
323
358
|
}
|
|
@@ -472,36 +507,12 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
472
507
|
keyCode: 219,
|
|
473
508
|
//'ctrl + ['
|
|
474
509
|
ctrl: true,
|
|
475
|
-
handle:
|
|
476
|
-
var _this$props4 = _this.props,
|
|
477
|
-
leftMarker = _this$props4.playerSelectedMarker.leftMarker,
|
|
478
|
-
onTagClick = _this$props4.onTagClick;
|
|
479
|
-
var newIndex = markers.findIndex(function (item) {
|
|
480
|
-
return item.in_time === leftMarker;
|
|
481
|
-
}) - 1;
|
|
482
|
-
if (leftMarker > -1 && newIndex > -1) {
|
|
483
|
-
var _markers$newIndex, _markers$newIndex2, _markers$newIndex3;
|
|
484
|
-
actions.seek((_markers$newIndex = markers[newIndex]) === null || _markers$newIndex === void 0 ? void 0 : _markers$newIndex.start_time);
|
|
485
|
-
onTagClick((_markers$newIndex2 = markers[newIndex]) === null || _markers$newIndex2 === void 0 ? void 0 : _markers$newIndex2.start_time, (_markers$newIndex3 = markers[newIndex]) === null || _markers$newIndex3 === void 0 ? void 0 : _markers$newIndex3.end_time, markers[newIndex]);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
510
|
+
handle: _this.debounceSegmentShiftBackward
|
|
488
511
|
}, {
|
|
489
512
|
keyCode: 221,
|
|
490
513
|
//'ctrl + ]'
|
|
491
514
|
ctrl: true,
|
|
492
|
-
handle:
|
|
493
|
-
var _this$props5 = _this.props,
|
|
494
|
-
leftMarker = _this$props5.playerSelectedMarker.leftMarker,
|
|
495
|
-
onTagClick = _this$props5.onTagClick;
|
|
496
|
-
var newIndex = markers.findIndex(function (item) {
|
|
497
|
-
return item.in_time === leftMarker;
|
|
498
|
-
}) + 1;
|
|
499
|
-
if (leftMarker > -1 && newIndex < markers.length) {
|
|
500
|
-
var _markers$newIndex4, _markers$newIndex5, _markers$newIndex6;
|
|
501
|
-
actions.seek((_markers$newIndex4 = markers[newIndex]) === null || _markers$newIndex4 === void 0 ? void 0 : _markers$newIndex4.start_time);
|
|
502
|
-
onTagClick((_markers$newIndex5 = markers[newIndex]) === null || _markers$newIndex5 === void 0 ? void 0 : _markers$newIndex5.start_time, (_markers$newIndex6 = markers[newIndex]) === null || _markers$newIndex6 === void 0 ? void 0 : _markers$newIndex6.end_time, markers[newIndex]);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
515
|
+
handle: _this.debounceSegmentShiftForward
|
|
505
516
|
}];
|
|
506
517
|
_this.shortcuts = _toConsumableArray(_this.defaultShortcuts);
|
|
507
518
|
_this.isCalled = false;
|
|
@@ -515,19 +526,19 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
515
526
|
key: "componentDidMount",
|
|
516
527
|
value: function componentDidMount() {
|
|
517
528
|
this.mergeShortcuts();
|
|
518
|
-
(0, _hotkeysJs["default"])('
|
|
529
|
+
(0, _hotkeysJs["default"])('w+right,right+w', {
|
|
519
530
|
keyup: true,
|
|
520
531
|
keydown: true
|
|
521
532
|
}, this.threeKeyCombo1);
|
|
522
|
-
(0, _hotkeysJs["default"])('
|
|
533
|
+
(0, _hotkeysJs["default"])('w+left,left+w', {
|
|
523
534
|
keyup: true,
|
|
524
535
|
keydown: true
|
|
525
536
|
}, this.threeKeyCombo2);
|
|
526
|
-
(0, _hotkeysJs["default"])('
|
|
537
|
+
(0, _hotkeysJs["default"])('q+right,right+q', {
|
|
527
538
|
keyup: true,
|
|
528
539
|
keydown: true
|
|
529
540
|
}, this.threeKeyCombo3);
|
|
530
|
-
(0, _hotkeysJs["default"])('
|
|
541
|
+
(0, _hotkeysJs["default"])('q+left,left+q', {
|
|
531
542
|
keyup: true,
|
|
532
543
|
keydown: true
|
|
533
544
|
}, this.threeKeyCombo4);
|
|
@@ -574,10 +585,10 @@ var Shortcut = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
574
585
|
}, {
|
|
575
586
|
key: "componentWillUnmount",
|
|
576
587
|
value: function componentWillUnmount() {
|
|
577
|
-
_hotkeysJs["default"].unbind('
|
|
578
|
-
_hotkeysJs["default"].unbind('
|
|
579
|
-
_hotkeysJs["default"].unbind('
|
|
580
|
-
_hotkeysJs["default"].unbind('
|
|
588
|
+
_hotkeysJs["default"].unbind('q+right,right+q');
|
|
589
|
+
_hotkeysJs["default"].unbind('w+right,right+w');
|
|
590
|
+
_hotkeysJs["default"].unbind('w+left,left+w');
|
|
591
|
+
_hotkeysJs["default"].unbind('w+left,left+w');
|
|
581
592
|
document.removeEventListener('keydown', this.handleKeyPress);
|
|
582
593
|
document.removeEventListener('click', this.handleClick);
|
|
583
594
|
document.removeEventListener('dblclick', this.handleDoubleClick);
|