Skip to content

Commit

Permalink
Prevent player movement when touch handler is holding an item
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Dec 12, 2023
1 parent 3c9cc3c commit b456739
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions srcjs/stendhal/ui/ViewPort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ export class ViewPort {
mHandle._onMouseDown = function(e: MouseEvent|TouchEvent) {
var pos = stendhal.ui.html.extractPosition(e);
if (stendhal.ui.touch.isTouchEvent(e)) {
if (stendhal.ui.touch.holdingItem()) {
// prevent default viewport action when item is "held"
return;
}
stendhal.ui.touch.onTouchStart(pos.pageX, pos.pageY);
}
if (stendhal.ui.globalpopup) {
Expand Down Expand Up @@ -369,6 +373,7 @@ export class ViewPort {
new ActionContextMenu(entity, append), pos.pageX - 50, pos.pageY - 5));
}
} else if (stendhal.ui.touch.holdingItem()) {
// FIXME: this may be unnecessary
stendhal.ui.gamewindow.onDrop(e);
} else {
entity.onclick(pos.canvasRelativeX, pos.canvasRelativeY);
Expand Down

0 comments on commit b456739

Please sign in to comment.