aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordax <me@dax.ist>2026-08-04 11:22:41 +0000
committerdax <me@dax.ist>2026-08-04 11:22:41 +0000
commit8a744362ff9a454d284b1385a7b30cce98271bfb (patch)
tree05bb8e5ea2caad7fc278f4056053393ce9a22b51
parent8786fda23190616dcdcbe8257c75bc8c1b6f82d6 (diff)
mouse keeps selection control until an explicit scroll; drags pan without re-selecting
-rw-r--r--public/app.js10
-rw-r--r--public/index.html4
2 files changed, 10 insertions, 4 deletions
diff --git a/public/app.js b/public/app.js
index a80623f..cce9bc8 100644
--- a/public/app.js
+++ b/public/app.js
@@ -328,6 +328,7 @@ function adjacentTile(id, dir) {
}
function traverseFrom(id, dir) {
+ followEnabled = false
const back = adjacentTile(id, dir)
if (back) {
hideGhost()
@@ -453,6 +454,7 @@ function refreshPreviews() {
}
let lastFollow = 0
+let followEnabled = true
function followCurrent() {
if (!tiles.size || !cur) return
const cx = (window.innerWidth / 2 - panX) / scale
@@ -482,7 +484,7 @@ function maybeFollow() {
if (now - lastFollow < 200) return
lastFollow = now
const before = cur && cur.id
- followCurrent()
+ if (followEnabled) followCurrent()
if (cur && cur.id === before) refreshPreviews()
}
@@ -501,11 +503,13 @@ stage.addEventListener("pointerdown", (e) => {
hideGhost()
world.style.transition = "none"
if (pointers.size === 2) {
+ followEnabled = true
drag = null
const [a, b] = [...pointers.values()]
pinchDist = Math.hypot(b.x - a.x, b.y - a.y)
return
}
+ followEnabled = false
drag = { x: e.clientX, y: e.clientY, px: panX, py: panY, moved: false, tile: e.target.closest(".tile") }
})
@@ -548,11 +552,12 @@ stage.addEventListener("pointerup", (e) => {
drag = null
world.style.transition = ""
if (wasDrag || !tile) {
- if (wasDrag) followCurrent()
+ if (wasDrag && followEnabled) followCurrent()
if (!wasDrag && !tile && e.pointerType === "touch") bgTap()
return
}
const id = Number(tile.dataset.id)
+ followEnabled = false
if (cur && cur.id === id) return
setCurrent(id, tiles.get(id).rect)
})
@@ -578,6 +583,7 @@ function bgTap() {
let zoomTimer = 0
stage.addEventListener("wheel", (e) => {
e.preventDefault()
+ followEnabled = true
let dx = e.deltaX
let dy = e.deltaY
if (e.deltaMode === 1) { dx *= 16; dy *= 16 }
diff --git a/public/index.html b/public/index.html
index 2e4f8c1..1514600 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>pathways</title>
- <link rel="stylesheet" href="/app.css?v=25">
+ <link rel="stylesheet" href="/app.css?v=26">
</head>
<body>
<main id="stage">
@@ -16,6 +16,6 @@
<p>four paths, one per direction. walk them.</p>
<button id="start">start</button>
</div>
- <script src="/app.js?v=25"></script>
+ <script src="/app.js?v=26"></script>
</body>
</html>