@scarlett-player/gestures 1.9.0 → 1.11.0
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/dist/index.cjs +20 -8
- package/dist/index.js +20 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -354,7 +354,7 @@ var GestureOverlay = class {
|
|
|
354
354
|
};
|
|
355
355
|
|
|
356
356
|
// src/version.ts
|
|
357
|
-
var PKG_VERSION = true ? "1.
|
|
357
|
+
var PKG_VERSION = true ? "1.11.0" : "0.0.0-dev";
|
|
358
358
|
|
|
359
359
|
// src/index.ts
|
|
360
360
|
function hasCoarsePointer() {
|
|
@@ -477,6 +477,19 @@ function createGesturesPlugin(config = {}) {
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
};
|
|
480
|
+
const syncSurface = () => {
|
|
481
|
+
if (!active || !api) return;
|
|
482
|
+
const wantsSurface = api.getState("mediaType") !== "audio";
|
|
483
|
+
if (wantsSurface && !overlay) {
|
|
484
|
+
overlay = new GestureOverlay(api.container, { onPointer, feedback });
|
|
485
|
+
overlay.setZoneWidths(leftZone, rightZone);
|
|
486
|
+
} else if (!wantsSurface && overlay) {
|
|
487
|
+
clearPendingHide();
|
|
488
|
+
overlay.destroy();
|
|
489
|
+
overlay = null;
|
|
490
|
+
recognizer?.reset();
|
|
491
|
+
}
|
|
492
|
+
};
|
|
480
493
|
return {
|
|
481
494
|
id: "gestures",
|
|
482
495
|
name: "Gestures",
|
|
@@ -490,10 +503,6 @@ function createGesturesPlugin(config = {}) {
|
|
|
490
503
|
api.logger.debug("[gestures] no coarse pointer, gesture surface not installed");
|
|
491
504
|
return;
|
|
492
505
|
}
|
|
493
|
-
if (api.getState("mediaType") === "audio") {
|
|
494
|
-
active = false;
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
506
|
recognizer = createRecognizer({
|
|
498
507
|
doubleTapWindowMs,
|
|
499
508
|
accumulationWindowMs: config.accumulationWindowMs,
|
|
@@ -501,9 +510,12 @@ function createGesturesPlugin(config = {}) {
|
|
|
501
510
|
rightZone,
|
|
502
511
|
slopPx: config.slopPx
|
|
503
512
|
});
|
|
504
|
-
|
|
505
|
-
|
|
513
|
+
syncSurface();
|
|
514
|
+
const unsubscribe = api.subscribeToState((event) => {
|
|
515
|
+
if (event.key === "mediaType") syncSurface();
|
|
516
|
+
});
|
|
506
517
|
api.onDestroy(() => {
|
|
518
|
+
unsubscribe();
|
|
507
519
|
clearPendingHide();
|
|
508
520
|
overlay?.destroy();
|
|
509
521
|
overlay = null;
|
|
@@ -522,7 +534,7 @@ function createGesturesPlugin(config = {}) {
|
|
|
522
534
|
api = null;
|
|
523
535
|
},
|
|
524
536
|
ownsTapInteraction() {
|
|
525
|
-
return active && tapToToggleControls;
|
|
537
|
+
return active && tapToToggleControls && overlay !== null;
|
|
526
538
|
}
|
|
527
539
|
};
|
|
528
540
|
}
|
package/dist/index.js
CHANGED
|
@@ -323,7 +323,7 @@ var GestureOverlay = class {
|
|
|
323
323
|
};
|
|
324
324
|
|
|
325
325
|
// src/version.ts
|
|
326
|
-
var PKG_VERSION = true ? "1.
|
|
326
|
+
var PKG_VERSION = true ? "1.11.0" : "0.0.0-dev";
|
|
327
327
|
|
|
328
328
|
// src/index.ts
|
|
329
329
|
function hasCoarsePointer() {
|
|
@@ -446,6 +446,19 @@ function createGesturesPlugin(config = {}) {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
|
+
const syncSurface = () => {
|
|
450
|
+
if (!active || !api) return;
|
|
451
|
+
const wantsSurface = api.getState("mediaType") !== "audio";
|
|
452
|
+
if (wantsSurface && !overlay) {
|
|
453
|
+
overlay = new GestureOverlay(api.container, { onPointer, feedback });
|
|
454
|
+
overlay.setZoneWidths(leftZone, rightZone);
|
|
455
|
+
} else if (!wantsSurface && overlay) {
|
|
456
|
+
clearPendingHide();
|
|
457
|
+
overlay.destroy();
|
|
458
|
+
overlay = null;
|
|
459
|
+
recognizer?.reset();
|
|
460
|
+
}
|
|
461
|
+
};
|
|
449
462
|
return {
|
|
450
463
|
id: "gestures",
|
|
451
464
|
name: "Gestures",
|
|
@@ -459,10 +472,6 @@ function createGesturesPlugin(config = {}) {
|
|
|
459
472
|
api.logger.debug("[gestures] no coarse pointer, gesture surface not installed");
|
|
460
473
|
return;
|
|
461
474
|
}
|
|
462
|
-
if (api.getState("mediaType") === "audio") {
|
|
463
|
-
active = false;
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
475
|
recognizer = createRecognizer({
|
|
467
476
|
doubleTapWindowMs,
|
|
468
477
|
accumulationWindowMs: config.accumulationWindowMs,
|
|
@@ -470,9 +479,12 @@ function createGesturesPlugin(config = {}) {
|
|
|
470
479
|
rightZone,
|
|
471
480
|
slopPx: config.slopPx
|
|
472
481
|
});
|
|
473
|
-
|
|
474
|
-
|
|
482
|
+
syncSurface();
|
|
483
|
+
const unsubscribe = api.subscribeToState((event) => {
|
|
484
|
+
if (event.key === "mediaType") syncSurface();
|
|
485
|
+
});
|
|
475
486
|
api.onDestroy(() => {
|
|
487
|
+
unsubscribe();
|
|
476
488
|
clearPendingHide();
|
|
477
489
|
overlay?.destroy();
|
|
478
490
|
overlay = null;
|
|
@@ -491,7 +503,7 @@ function createGesturesPlugin(config = {}) {
|
|
|
491
503
|
api = null;
|
|
492
504
|
},
|
|
493
505
|
ownsTapInteraction() {
|
|
494
|
-
return active && tapToToggleControls;
|
|
506
|
+
return active && tapToToggleControls && overlay !== null;
|
|
495
507
|
}
|
|
496
508
|
};
|
|
497
509
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scarlett-player/gestures",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Gestures Plugin for Scarlett Player - double-tap seek zones and tap to toggle controls",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@scarlett-player/core": "^1.
|
|
25
|
+
"@scarlett-player/core": "^1.9.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@vitest/coverage-v8": "^1.6.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tsup": "^8.5.1",
|
|
31
31
|
"typescript": "^5.3.0",
|
|
32
32
|
"vitest": "^1.6.0",
|
|
33
|
-
"@scarlett-player/core": "1.
|
|
33
|
+
"@scarlett-player/core": "1.11.0"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"video",
|