31 lines
1.2 KiB
Markdown
31 lines
1.2 KiB
Markdown
---
|
|
id: TASK-84
|
|
title: Fix shape x/y/size preservation on canvas reload
|
|
status: Done
|
|
assignee: []
|
|
created_date: '2026-03-03 07:42'
|
|
labels:
|
|
- bugfix
|
|
- canvas
|
|
- shapes
|
|
dependencies: []
|
|
references:
|
|
- lib/folk-shape.ts
|
|
- website/canvas.html
|
|
priority: high
|
|
---
|
|
|
|
## Description
|
|
|
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
|
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.
|
|
<!-- SECTION:DESCRIPTION:END -->
|
|
|
|
## Final Summary
|
|
|
|
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
|
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.
|
|
<!-- SECTION:FINAL_SUMMARY:END -->
|