From 17fee1a4da150d51d58401e98cdd0c34e6d5d074 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 1 Dec 2023 17:09:10 -0800 Subject: [PATCH] Clean up "held" item on mouse up event --- srcjs/stendhal/ui/ViewPort.ts | 3 +++ srcjs/stendhal/ui/component/ItemContainerImplementation.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/srcjs/stendhal/ui/ViewPort.ts b/srcjs/stendhal/ui/ViewPort.ts index e2c09bda565..1446e232ba4 100644 --- a/srcjs/stendhal/ui/ViewPort.ts +++ b/srcjs/stendhal/ui/ViewPort.ts @@ -395,6 +395,9 @@ export class ViewPort { e.target.removeEventListener("mousemove", mHandle.onDrag); e.target.removeEventListener("touchend", mHandle.onMouseUp); e.target.removeEventListener("touchmove", mHandle.onDrag); + + // clean up item held via touch + stendhal.ui.touch.unsetHeldItem(); } return mHandle._onMouseDown; diff --git a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts index b4b3665c8ad..71b91affbb2 100644 --- a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts +++ b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts @@ -302,6 +302,10 @@ export class ItemContainerImplementation { } } } + + // clean up item held via touch + stendhal.ui.touch.unsetHeldItem(); + document.getElementById("gamewindow")!.focus(); }