diff --git a/packages/page-controller/src/mask/SimulatorMask.ts b/packages/page-controller/src/mask/SimulatorMask.ts index ec986cc..1e6984e 100644 --- a/packages/page-controller/src/mask/SimulatorMask.ts +++ b/packages/page-controller/src/mask/SimulatorMask.ts @@ -132,6 +132,7 @@ export class SimulatorMask extends EventTarget { #moveCursorToTarget() { if (this.#disposed) return + const newX = this.#currentCursorX + (this.#targetCursorX - this.#currentCursorX) * 0.2 const newY = this.#currentCursorY + (this.#targetCursorY - this.#currentCursorY) * 0.2 @@ -159,11 +160,15 @@ export class SimulatorMask extends EventTarget { } setCursorPosition(x: number, y: number) { + if (this.#disposed) return + this.#targetCursorX = x this.#targetCursorY = y } triggerClickAnimation() { + if (this.#disposed) return + this.#cursor.classList.remove(cursorStyles.clicking) // Force reflow to restart animation void this.#cursor.offsetHeight @@ -171,7 +176,7 @@ export class SimulatorMask extends EventTarget { } show() { - if (this.shown) return + if (this.shown || this.#disposed) return this.shown = true this.motion?.start() @@ -189,7 +194,7 @@ export class SimulatorMask extends EventTarget { } hide() { - if (!this.shown) return + if (!this.shown || this.#disposed) return this.shown = false this.motion?.fadeOut()