From c0d04e87acb12d659ccbcb131141c963392c8943 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Sun, 17 Mar 2024 18:58:35 -0500 Subject: [PATCH] fix: Flakey test --- src/engine/Engine.ts | 4 ++++ src/engine/Input/PointerEventReceiver.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/engine/Engine.ts b/src/engine/Engine.ts index 1e17f6419..1d5d46d0a 100644 --- a/src/engine/Engine.ts +++ b/src/engine/Engine.ts @@ -1137,6 +1137,10 @@ O|===|* >________________>\n\ } } + public isDisposed() { + return this._disposed; + } + /** * Returns a BoundingBox of the top left corner of the screen * and the bottom right corner of the screen. diff --git a/src/engine/Input/PointerEventReceiver.ts b/src/engine/Input/PointerEventReceiver.ts index c713b5457..e453606fe 100644 --- a/src/engine/Input/PointerEventReceiver.ts +++ b/src/engine/Input/PointerEventReceiver.ts @@ -249,6 +249,9 @@ export class PointerEventReceiver { * browser events. */ public init(options?: PointerInitOptions) { + if (this.engine.isDisposed()) { + return; + } // Disabling the touch action avoids browser/platform gestures from firing on the canvas // It is important on mobile to have touch action 'none' // https://stackoverflow.com/questions/48124372/pointermove-event-not-working-with-touch-why-not