From fba72e4c658bcb684923d83ec59d6461a66df382 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 20 Feb 2024 14:25:52 -0800 Subject: [PATCH] Only register inventory double clicks/taps if target ID is same... ...for both https://github.com/arianne/stendhal/issues/417 --- srcjs/stendhal/ui/component/ItemContainerImplementation.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts index e04218cba06..ae19394ab07 100644 --- a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts +++ b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts @@ -31,6 +31,7 @@ export class ItemContainerImplementation { private rightClickDuration = 300; private timestampMouseDown = 0; private timestampMouseDownPrev = 0; + private lastClickedId = ""; // marked for updating certain attributes private dirty = false; @@ -295,7 +296,11 @@ export class ItemContainerImplementation { } isDoubleClick(evt: MouseEvent) { - return (this.timestampMouseDown - this.timestampMouseDownPrev <= this.rightClickDuration); + if (this.timestampMouseDown - this.timestampMouseDownPrev <= this.rightClickDuration) { + return (stendhal.ui.html.extractTarget(event) as HTMLElement).id === this.lastClickedId; + } + this.lastClickedId = (stendhal.ui.html.extractTarget(event) as HTMLElement).id; + return false; } onMouseDown(event: MouseEvent|TouchEvent) {