PR_26179_CHARLIE_035-sprites-frame-editing#272
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eae87196a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| editorState.frames.forEach((frame) => { | ||
| frame.paintedPixels.clear(); | ||
| }); |
There was a problem hiding this comment.
Preserve other frames when applying undo snapshots
When multiple frames exist, any Undo/Redo path calls applySnapshot(), which calls setGridSize(...); this new loop clears every frame before applySnapshot() restores only the active frame's snapshot.paintedPixels. For example, paint Frame 1, add and paint Frame 2, then press Undo while on Frame 2: Frame 1's pixels are silently erased when you select it again. The snapshot restore needs to avoid clearing unrelated frames or snapshot/restore the full frame set.
Useful? React with 👍 / 👎.
| editorState.frames.splice(editorState.activeFrameIndex, 1); | ||
| renumberFrames(); | ||
| editorState.activeFrameIndex = Math.max(0, Math.min(editorState.activeFrameIndex, editorState.frames.length - 1)); |
There was a problem hiding this comment.
Drop deleted-frame undo history
When the active frame has edit history, deleting it leaves those snapshots in the global undo stack and keeps Undo enabled. If a user paints Frame 2, deletes Frame 2, then presses Undo, applySnapshot() clamps that stale frame index to the remaining frame and overwrites Frame 1 with Frame 2's snapshot. Either record frame deletion in history or remove snapshots for the deleted frame before exposing Undo again.
Useful? React with 👍 / 👎.
Summary
Validation
Artifact