Skip to content

fix: keep photo aligned with tool outline under rotation#131

Merged
jasonmadigan merged 1 commit into
mainfrom
129-rotation-photo-misalignment
Jul 6, 2026
Merged

fix: keep photo aligned with tool outline under rotation#131
jasonmadigan merged 1 commit into
mainfrom
129-rotation-photo-misalignment

Conversation

@jasonmadigan

Copy link
Copy Markdown
Collaborator

Summary

  • Undo/redo history only snapshotted geometry, so the photo transform went stale and repeated rotations compounded into the misalignment reported in Rotating tool outline results in misaligned underlying photo #129. History entries now carry the photo transform and undo/redo restores it.
  • Auto-rotate split one operation across two layers (page rotated geometry, editor rotated the photo) with a pre-rotation history push, leaving redo dead and undo skipping a step. It now runs through a single rotateAll path: geometry + photo + one history entry.
  • The post-await history push is routed through a ref so edits landing while the auto-rotate request is in flight cannot corrupt history.

Test evidence

  • make lint-frontend: 0 errors
  • vitest: 80/80
  • Playwright e2e: 23/23, three consecutive full-suite runs. Three new regression tests, each verified to fail before the fix: rotate/undo/redo photo round-trip, auto-rotate rigid-transform coupling between outline and photo, interleaved edit during auto-rotate fetch.

Closes #129

The tool editor's undo history tracked only geometry, so undoing a
rotate or flip restored the outline while the source photo kept its
rotated transform; the next rotation (auto-rotate included) then
compounded the divergence. Auto-rotate also split the operation across
the page (geometry) and the editor (photo), pushing a pre-rotation
history entry and never the rotated state.

Snapshot the photo transform in every history entry and restore it on
undo/redo, and route auto-rotate through rotateAll so the outline,
photo and history change as one operation. The post-fetch rotation goes
through a ref to the latest rotateAll: edits landing during the fetch
would otherwise resolve against a stale history index and drop entries.

Fixes #129

Signed-off-by: Jason Madigan <[email protected]>
@jasonmadigan
jasonmadigan marked this pull request as ready for review July 6, 2026 21:12
@jasonmadigan
jasonmadigan merged commit eba11f8 into main Jul 6, 2026
3 checks passed
@jasonmadigan
jasonmadigan deleted the 129-rotation-photo-misalignment branch July 6, 2026 21:14
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.

Rotating tool outline results in misaligned underlying photo

1 participant