Skip to content

feat(editor): modified-state tracking, background-image persistence, layer-aware selection#30

Merged
DanteCpp merged 2 commits into
mainfrom
dev
Jun 19, 2026
Merged

feat(editor): modified-state tracking, background-image persistence, layer-aware selection#30
DanteCpp merged 2 commits into
mainfrom
dev

Conversation

@DanteCpp

Copy link
Copy Markdown
Owner

Summary

Bundles the current dev work onto main. Two commits: an editor/feature commit plus the earlier FidoCad format notes.

Editor

  • Mark the document modified on align/distribute/nudge, image transforms, attach/detach, and during drag-move/handle-drag so unsaved-work prompts fire correctly.
  • Add Ctrl+G shortcut to open the circuit-code ("Define") dialog.

Background image

  • The .fcd stays pure text (geometry only via FJC IMG x y scale alpha); image bytes are re-attached from localStorage on load through a pendingRestore flag and an async whenReady() bridge, with zoom-to-fit once ready.
  • Detaching an image clears its localStorage cache so it doesn't reappear on reload.

Selection / parser

  • Centralized layer-visibility checks (isVisibleForSelection), correctly handling multi-layer macros via containsLayer.
  • Unrecognized macro keys are dropped instead of leaving an empty placeholder primitive (matches FidoCadJ behavior).
  • Macro-expansion depth is now process-wide, bounding nested parsing.

Tests / tooling

  • Memoized the stubbed 2D canvas context (matches real browser getContext('2d') identity) and recorded putImageData calls for assertions.
  • Ratcheted coverage thresholds to 65/65/60/79.
  • Added a docs:tests generator script and broadened unit/e2e coverage.

Test plan

  • npm run typecheck passes.
  • Expanded unit + e2e suites cover the new selection, image-restore, and dirty-state paths.

DanteCpp added 2 commits June 11, 2026 19:42
…er-aware selection

Editor:
- Mark the document modified on align/distribute/nudge, image transforms,
  attach/detach, and during drag-move/handle-drag so unsaved-work prompts fire.
- Add Ctrl+G shortcut to open the circuit-code ("Define") dialog.

Background image:
- Keep the .fcd as pure text (geometry only via FJC IMG) and re-attach the
  image bytes from localStorage on load via a pendingRestore flag and an
  async whenReady() bridge; zoom-to-fit once the image is ready.
- Drop the localStorage cache on detach so removed images don't return.

Selection / parser:
- Centralize layer-visibility checks (isVisibleForSelection) and handle
  multi-layer macros via containsLayer.
- Drop unrecognized macro keys instead of leaving an empty placeholder.
- Make macro-expansion depth process-wide to bound nested parsing.

Tests / tooling:
- Memoize the stubbed 2D canvas context and record putImageData calls.
- Ratchet coverage thresholds to 65/65/60/79.
- Add docs:tests generator script and broaden unit/e2e coverage.
@DanteCpp
DanteCpp merged commit 013ba62 into main Jun 19, 2026
9 checks passed
@DanteCpp
DanteCpp deleted the dev branch June 19, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant