auto-save 2026-05-14 00:20 (+4, ~4)

This commit is contained in:
2026-05-14 00:20:30 +08:00
parent 6cd0713230
commit 540107d505
8 changed files with 989 additions and 13 deletions

View File

@@ -7,13 +7,11 @@ export function ResizeRight({ minWidth = 240, maxWidth = 1200 }: { minWidth?: nu
const { setNodes, getZoom } = useReactFlow()
const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {
console.log("[ResizeRight] pointerDown", e.clientX, e.clientY)
e.preventDefault()
e.stopPropagation()
const target = e.currentTarget
const nodeEl = target.closest(".react-flow__node") as HTMLElement | null
const nodeId = nodeEl?.getAttribute("data-id")
console.log("[ResizeRight] nodeId", nodeId)
if (!nodeId || !nodeEl) return
target.setPointerCapture(e.pointerId)
@@ -24,11 +22,9 @@ export function ResizeRight({ minWidth = 240, maxWidth = 1200 }: { minWidth?: nu
const onMove = (ev: globalThis.PointerEvent) => {
const dx = (ev.clientX - startX) / zoom
const next = Math.max(minWidth, Math.min(maxWidth, startWidth + dx))
console.log("[ResizeRight] move", dx, next)
setNodes((nodes) => nodes.map((n) => (n.id === nodeId ? { ...n, width: next, style: { ...n.style, width: next } } : n)))
}
const onUp = () => {
console.log("[ResizeRight] up")
window.removeEventListener("pointermove", onMove)
window.removeEventListener("pointerup", onUp)
try { target.releasePointerCapture(e.pointerId) } catch {}