aboutsummaryrefslogtreecommitdiff
path: root/public/app.js
diff options
context:
space:
mode:
authordax <me@dax.ist>2026-08-04 09:22:43 +0000
committerdax <me@dax.ist>2026-08-04 09:22:43 +0000
commit31377791a19454e76cf3f4f74f1d90e3460f5c2d (patch)
tree9b4cc2b7abce31933a5f3bdfc15ed954eb5053fa /public/app.js
parent598d24645f5ffce7d4551d4d7def183f4cb14a7a (diff)
pathways: no dead-end directions while photos remain - server extends short walks with library ids to 60 entries, client falls back to any remaining unplaced photo when a direction's walk is exhausted
Diffstat (limited to 'public/app.js')
-rw-r--r--public/app.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/public/app.js b/public/app.js
index 1c98d84..57827fa 100644
--- a/public/app.js
+++ b/public/app.js
@@ -274,6 +274,13 @@ function choosePlacement(id, dir) {
const p = bestPlacement(tileW(info), tileH(info), from, dir)
if (p) scored.push({ id: cid, info, rect: p.rect, cost: p.cost })
}
+ if (!scored.length) {
+ for (const [cid, info] of photoInfo) {
+ if (rectOf.has(cid) || cid === id) continue
+ const p = bestPlacement(tileW(info), tileH(info), from, dir)
+ if (p) scored.push({ id: cid, info, rect: p.rect, cost: p.cost + (claimed.has(cid) ? 1e12 : 0) })
+ }
+ }
if (!scored.length) return null
scored.sort((a, b) => a.cost - b.cost)
const best = scored[0]