mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Stories: read whether the story was playing before the press stops it
The director's own pointerdown listener, added first, stops a run whose camera it drives before Stories heard the press, so the tap still played the story again. Stories now reads the press in the capture phase, and its tap listeners are removed on teardown.
This commit is contained in:
1 parent
40f537a8b9
commit
78b8d8dc78
2 files changed
+24
-7
No files matched your search
@@ -745,7 +745,8 @@ export function createStoriesController({
|
||||
let downAt = null;
|
||||
// Whether the story was playing when the tap began: a camera move the
|
||||
// scene drives frame by frame stops on the press itself, before the tap
|
||||
// ends, and that tap still means pause.
|
||||
// ends, and that tap still means pause. The press is read in the capture
|
||||
// phase, before the director's own listener can stop the run.
|
||||
let playingAtDown = false;
|
||||
const onDown = (e) => {
|
||||
downAt = [e.clientX, e.clientY];
|
||||
@@ -768,7 +769,7 @@ export function createStoriesController({
|
||||
store.bigPlay = true;
|
||||
} else player.play();
|
||||
};
|
||||
canvas.addEventListener('pointerdown', onDown);
|
||||
canvas.addEventListener('pointerdown', onDown, true);
|
||||
canvas.addEventListener('pointerup', onUp);
|
||||
|
||||
/** @returns {boolean} False when the camera is not free (Cockpit). */
|
||||
@@ -1237,7 +1238,8 @@ export function createStoriesController({
|
||||
useInstalledScenes(null);
|
||||
removeEventListener('popstate', onPopState);
|
||||
removeEventListener('popstate', onLandingCapture, true);
|
||||
canvas.removeEventListener('pointerdown', onDown);
|
||||
canvas.removeEventListener('pointerdown', onDown, true);
|
||||
canvas.removeEventListener('pointerup', onUp);
|
||||
canvas.removeEventListener('pointerdown', onExploreInput);
|
||||
canvas.removeEventListener('pointerup', onExploreInput);
|
||||
canvas.removeEventListener('pointercancel', onExploreInput);
|
||||
|
||||
Reference in new issue
Block a user