Adding fixes that lets us pull a myster in the db into a json file

This commit is contained in:
2026-08-23 21:37:06 +02:00
parent 3c099a5daa
commit 7dec2994b4
8 changed files with 719 additions and 290 deletions
+11 -8
View File
@@ -878,17 +878,20 @@ function Board({ state, selected, locatorDocumentId, linkFrom, recentlyCreatedEx
}
}
if (!drag.current) return
const dx = event.clientX - drag.current.startX, dy = event.clientY - drag.current.startY
if (Math.abs(dx) + Math.abs(dy) > 4) drag.current.moved = true
if (drag.current.kind === 'widget') {
// Snapshot the drag ref: the `update` closures below run inside a React state
// updater (deferred/possibly re-invoked), by which point `drag.current` may be null.
const active = drag.current
const dx = event.clientX - active.startX, dy = event.clientY - active.startY
if (Math.abs(dx) + Math.abs(dy) > 4) active.moved = true
if (active.kind === 'widget') {
const bounds = trashRef.current?.getBoundingClientRect()
const overTrash = Boolean(bounds && event.clientX >= bounds.left && event.clientX <= bounds.right && event.clientY >= bounds.top && event.clientY <= bounds.bottom)
trashTarget.current = overTrash
setTrashActive(overTrash)
}
if (drag.current.kind === 'thread-tag' && boardRef.current) {
if (drag.current.moved) setExpandedThreadTagId(null)
const connection = state.connections.find(item => item.id === drag.current!.id)
if (active.kind === 'thread-tag' && boardRef.current) {
if (active.moved) setExpandedThreadTagId(null)
const connection = state.connections.find(item => item.id === active.id)
const from = connection ? pointForId(connection.fromExhibitId) : undefined
const to = connection ? pointForId(connection.toExhibitId) : undefined
if (connection && from && to) {
@@ -897,8 +900,8 @@ function Board({ state, selected, locatorDocumentId, linkFrom, recentlyCreatedEx
const placement = projectThreadTag(from, to, connection.tightness ?? 65, pointer)
update(s => ({ ...s, connections: s.connections.map(item => item.id === connection.id ? { ...item, tagPosition: placement.positionPercent, tagOffset: placement.lateralOffset } : item) }))
}
} else if (drag.current.kind === 'widget') update(s => { const next = moveBoardPoint({ x: drag.current!.originX, y: drag.current!.originY }, { x: dx, y: dy }, s.viewport.zoom); return { ...s, exhibits: s.exhibits.map(exhibit => exhibit.id === drag.current!.id ? { ...exhibit, ...next } : exhibit) } })
else update(s => ({ ...s, viewport: panViewport({ ...s.viewport, x: drag.current!.originX, y: drag.current!.originY }, { x: dx, y: dy }) }))
} else if (active.kind === 'widget') update(s => { const next = moveBoardPoint({ x: active.originX, y: active.originY }, { x: dx, y: dy }, s.viewport.zoom); return { ...s, exhibits: s.exhibits.map(exhibit => exhibit.id === active.id ? { ...exhibit, ...next } : exhibit) } })
else update(s => ({ ...s, viewport: panViewport({ ...s.viewport, x: active.originX, y: active.originY }, { x: dx, y: dy }) }))
}
const finishDrag = (event: React.PointerEvent) => {
if (folderLongPress.current?.pointerId === event.pointerId) {