Fix web dashboard bug where tooltip would move on click
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
let itemNames = {};
|
||||
let lastInventorySignature = '';
|
||||
let lastState = null;
|
||||
let lastInputMethod = 'pointer';
|
||||
let selectedInventoryItem = null;
|
||||
let menuAnchor = null;
|
||||
let toastTimer = null;
|
||||
@@ -527,7 +528,7 @@
|
||||
});
|
||||
inventoryGrid.addEventListener('focusin', (event) => {
|
||||
const slot = event.target.closest('.inventory-slot.interactive');
|
||||
if (!slot) return;
|
||||
if (!slot || lastInputMethod !== 'keyboard') return;
|
||||
const rect = slot.getBoundingClientRect();
|
||||
showItemTooltip(slot, {x: rect.right, y: rect.top});
|
||||
});
|
||||
@@ -548,6 +549,13 @@
|
||||
openInventoryMenu(slot);
|
||||
});
|
||||
|
||||
document.addEventListener('pointerdown', () => {
|
||||
lastInputMethod = 'pointer';
|
||||
}, true);
|
||||
document.addEventListener('keydown', () => {
|
||||
lastInputMethod = 'keyboard';
|
||||
}, true);
|
||||
|
||||
$('inventory-menu').addEventListener('click', (event) => {
|
||||
const button = event.target.closest('button[data-inventory-action]');
|
||||
if (!button || button.disabled) return;
|
||||
|
||||
Reference in New Issue
Block a user