From ce8c842f74aadcabc2dc6899e6c2609075cc356f Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Sun, 7 Apr 2024 11:00:16 +0800 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 85a5ad1d356463b7dbd280e67ed0c5d5fa92d222 Author: joylink_zhaoerwei Date: Sun Apr 7 10:59:07 2024 +0800 列车驾驶台调整--改变位置后调接口 --- src/drawApp/graphics/TccHandleInteraction.ts | 6 ++++++ src/drawApp/graphics/TccKeyInteraction.ts | 1 + src/drawApp/tccScene.ts | 2 -- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/drawApp/graphics/TccHandleInteraction.ts b/src/drawApp/graphics/TccHandleInteraction.ts index c625b47..d793c42 100644 --- a/src/drawApp/graphics/TccHandleInteraction.ts +++ b/src/drawApp/graphics/TccHandleInteraction.ts @@ -86,6 +86,7 @@ export class TccHandleInteraction extends GraphicInteractionPlugin { isMouseDown = false; mouseDownBeginPos = 0; mouseDownTccHandleBeginPos = 0; + timeout: string | number | NodeJS.Timeout | undefined; constructor(app: IGraphicScene) { super(TccHandleInteraction.Name, app); } @@ -116,6 +117,7 @@ export class TccHandleInteraction extends GraphicInteractionPlugin { g._tccHandle.onmousedown = null; g._tccHandle.onmouseup = null; g.onmousemove = null; + clearTimeout(this.timeout); } onMouseDown(e: FederatedMouseEvent) { const target = e.target as DisplayObject; @@ -144,6 +146,10 @@ export class TccHandleInteraction extends GraphicInteractionPlugin { } else if (tccHandle._tccHandle.y <= -145) { tccHandle._tccHandle.y = -144; } + clearTimeout(this.timeout); + this.timeout = setTimeout(() => { + useTccStore().onMouseUpFromTccHandle(); + }, 100); } } onMouseUp() { diff --git a/src/drawApp/graphics/TccKeyInteraction.ts b/src/drawApp/graphics/TccKeyInteraction.ts index 25b61ea..a79e4d5 100644 --- a/src/drawApp/graphics/TccKeyInteraction.ts +++ b/src/drawApp/graphics/TccKeyInteraction.ts @@ -207,6 +207,7 @@ export abstract class KeyInteraction< if (this.lastTimenRotation !== this.changeRotation) { this.lastTimenRotation = this.changeRotation; this.ratatingSprite.rotation = this.changeRotation; + useTccStore().onMouseUpFromTccKeyDir(); } } else { if (direction == 'ssz') { diff --git a/src/drawApp/tccScene.ts b/src/drawApp/tccScene.ts index 1e5fb60..5beeca6 100644 --- a/src/drawApp/tccScene.ts +++ b/src/drawApp/tccScene.ts @@ -60,11 +60,9 @@ export function initTccScene(lineApp: IGraphicApp, sceneName: string) { tccScene.canvas.onmouseup = () => { tccStore.canvasMouseDown = false; if (tccStore.mouseDownOnTccHandle) { - tccStore.onMouseUpFromTccHandle(); tccStore.mouseDownOnTccHandle = false; } if (tccStore.mouseDownOnTccKeyDir) { - tccStore.onMouseUpFromTccKeyDir(); tccStore.mouseDownOnTccKeyDir = false; } };