aboutsummaryrefslogtreecommitdiff
path: root/public/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/app.js')
-rw-r--r--public/app.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/public/app.js b/public/app.js
index ed1c6d6..9c6d187 100644
--- a/public/app.js
+++ b/public/app.js
@@ -35,6 +35,7 @@ let scale = 1
let userZoomed = false
let drag = null
let hoveredSlot = null
+let suppressHover = false
const TOUCH = typeof window.matchMedia === "function" && window.matchMedia("(hover: none)").matches
@@ -199,6 +200,7 @@ function setCurrent(id, rect, recenter = true) {
if (!userZoomed) scale = worldScale()
center()
hoveredSlot = null
+ suppressHover = true
}
getExits(id)
if (prevId && prevId !== id) renderNav(prevId)
@@ -239,7 +241,7 @@ async function getExits(id) {
const exits = data.exits || []
exitsCache.set(id, exits)
renderNav(id)
- if (!drag) {
+ if (!drag && !suppressHover) {
const s = findSlotAt(lastCursor.wx, lastCursor.wy)
if (s) { hoveredSlot = s; refreshPreviews() }
}
@@ -478,6 +480,7 @@ stage.addEventListener("pointerdown", (e) => {
pointers.set(e.pointerId, { x: e.clientX, y: e.clientY })
try { stage.setPointerCapture(e.pointerId) } catch { /* ignore */ }
hoveredSlot = null
+ suppressHover = true
hideSlot()
world.style.transition = "none"
if (pointers.size === 2) {
@@ -494,6 +497,7 @@ stage.addEventListener("pointerdown", (e) => {
stage.addEventListener("pointermove", (e) => {
lastCursor.wx = (e.clientX - panX) / scale
lastCursor.wy = (e.clientY - panY) / scale
+ suppressHover = false
if (pointers.has(e.pointerId)) {
pointers.set(e.pointerId, { x: e.clientX, y: e.clientY })
if (pointers.size === 2 && pinchDist > 0) {
@@ -578,6 +582,7 @@ stage.addEventListener("wheel", (e) => {
if (e.deltaMode === 1) { dx *= 16; dy *= 16 }
else if (e.deltaMode === 2) { dx *= window.innerWidth; dy *= window.innerHeight }
world.style.transition = "none"
+ suppressHover = true
if (e.ctrlKey) {
hoveredSlot = null
hideSlot()