rspace-online/backlog/tasks/task-84 - Fix-shape-x-y-siz...

1.2 KiB

id title status assignee created_date labels dependencies references priority
TASK-84 Fix shape x/y/size preservation on canvas reload Done
2026-03-03 07:42
bugfix
canvas
shapes
lib/folk-shape.ts
website/canvas.html
high

Description

All canvas shapes stacked at (0,0) on page reload. Root cause: FolkShape.createRenderRoot() unconditionally read x/y/width/height from HTML attributes, but canvas.html sets these as JS properties before DOM insertion. Since attributes don't exist, everything defaulted to 0/auto.

Fixed to only read from attributes when they actually exist (getAttribute !== null). Also fixed eraser: hardDeleteShape() was only in a click handler that never fired because pointerdown already removed the target element — moved Automerge deletion into pointerdown.

Final Summary

Fixed createRenderRoot() to conditionally read from HTML attributes only when present. Fixed eraser to persist deletions to Automerge in pointerdown handler instead of unreachable click handler. Committed as 4f9b036.