diff --git a/html/app.js b/html/app.js index e17a42ac8..f2dc13905 100644 --- a/html/app.js +++ b/html/app.js @@ -210,7 +210,13 @@ const InventoryContainer = Vue.createApp({ getHotbarItemInSlot(slot) { return this.hotbarItems[slot - 1] || null; }, + containerMouseDownAction(event){ + if (event.button === 0 && this.showContextMenu) { + this.showContextMenu = false + } + }, handleMouseDown(event, slot, inventory) { + if (event.button === 1) return; // skip middle mouse event.preventDefault(); const itemInSlot = this.getItemInSlot(slot, inventory); if (event.button === 0) { @@ -298,6 +304,7 @@ const InventoryContainer = Vue.createApp({ this.dragStartX = event.clientX; this.dragStartY = event.clientY; this.dragStartInventoryType = inventoryType; + this.showContextMenu = false }, createGhostElement(slotElement) { const ghostElement = slotElement.cloneNode(true); diff --git a/html/index.html b/html/index.html index 8c4d1c190..7fa01abb1 100644 --- a/html/index.html +++ b/html/index.html @@ -16,7 +16,7 @@