-
Notifications
You must be signed in to change notification settings - Fork 1
Improve editor reuse safety and harden crop/save session handling (thanks to DJShortCut for these suggestions!) #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
10fe356
Improve editor reuse safety and harden crop/save session handling
AlanRockefeller b37bd5c
format with black
AlanRockefeller 7784b02
fix more crop box bugs
AlanRockefeller 3adaeeb
updated toggle_crop_mode() to explicitly call self._kick_preview_work…
AlanRockefeller 0ca9699
minor bug fixes
AlanRockefeller 8bcff99
format with black
AlanRockefeller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the crop UI state in sync when these branches zero out rotation.
Line 6851 and Line 6887 reset
image_editor'sstraighten_angle, but they do not reset the correspondingui_statefields. That means the preview can snap back to 0° while the crop overlay/slider still shows the old angle until some other sync path runs._reset_crop_settings()already handles this UI-side reset, so crop enter/cancel should do the same here.🔧 Proposed fix
if self.ui_state.isCropping: self.ui_state.isCropping = False self.ui_state.currentCropBox = (0, 0, 1000, 1000) # Ensure backend crop state and preview rotation are cleared self.image_editor.set_crop_box(None) self.image_editor.set_edit_param("straighten_angle", 0.0) + if hasattr(self.ui_state, "straighten_angle"): + self.ui_state.straighten_angle = 0.0 + if hasattr(self.ui_state, "cropRotation"): + self.ui_state.cropRotation = 0.0 # Notify UI and kick fresh render self.ui_refresh_generation += 1 self._kick_preview_worker() self.update_status_message("Crop cancelled") @@ self.ui_state.aspectRatioNames = [r["name"] for r in ASPECT_RATIOS] self.ui_state.currentAspectRatioIndex = 0 # Reset rotation to 0 when starting fresh crop mode self.image_editor.set_edit_param("straighten_angle", 0.0) + if hasattr(self.ui_state, "straighten_angle"): + self.ui_state.straighten_angle = 0.0 + if hasattr(self.ui_state, "cropRotation"): + self.ui_state.cropRotation = 0.0 self._kick_preview_worker() self.update_status_message("Crop mode: Drag to select area, Enter to crop")Also applies to: 6881-6888
🤖 Prompt for AI Agents