From 150578b52ef6054bb769e70052a0b5367b94aaf0 Mon Sep 17 00:00:00 2001 From: AlanRockefeller Date: Wed, 8 Apr 2026 21:03:59 -0700 Subject: [PATCH 1/4] fix minor issues --- faststack/app.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/faststack/app.py b/faststack/app.py index 13910fa..13e5f08 100644 --- a/faststack/app.py +++ b/faststack/app.py @@ -6844,11 +6844,7 @@ def _apply_preview_result(self, payload): def cancel_crop_mode(self): """Cancel crop mode without applying changes.""" 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) + self._reset_crop_settings() # Notify UI and kick fresh render self.ui_refresh_generation += 1 self._kick_preview_worker() @@ -6878,13 +6874,15 @@ def toggle_crop_mode(self): self.ui_state.isCropping = True # Reset to full image defaults (UI and Backend) - self.ui_state.currentCropBox = (0, 0, 1000, 1000) - self.image_editor.set_crop_box(None) + self._reset_crop_settings() + # Restore isCropping after helper might have cleared it (if it was somehow already True) + self.ui_state.isCropping = True + 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) + # Ensure UI and backend are synced and kick render + self.ui_refresh_generation += 1 self._kick_preview_worker() self.update_status_message("Crop mode: Drag to select area, Enter to crop") From 30e8261213092952b4278f038c23874e4e100d37 Mon Sep 17 00:00:00 2001 From: AlanRockefeller Date: Wed, 8 Apr 2026 21:04:18 -0700 Subject: [PATCH 2/4] format with black --- faststack/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faststack/app.py b/faststack/app.py index 13e5f08..f2178a5 100644 --- a/faststack/app.py +++ b/faststack/app.py @@ -6877,7 +6877,7 @@ def toggle_crop_mode(self): self._reset_crop_settings() # Restore isCropping after helper might have cleared it (if it was somehow already True) self.ui_state.isCropping = True - + self.ui_state.aspectRatioNames = [r["name"] for r in ASPECT_RATIOS] self.ui_state.currentAspectRatioIndex = 0 From c0a3bdb4b2dff05764c2fa1c508a0b8e1379b24c Mon Sep 17 00:00:00 2001 From: AlanRockefeller Date: Wed, 8 Apr 2026 21:21:34 -0700 Subject: [PATCH 3/4] fix crop rotation reset bug --- faststack/app.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/faststack/app.py b/faststack/app.py index f2178a5..efecee8 100644 --- a/faststack/app.py +++ b/faststack/app.py @@ -3177,14 +3177,18 @@ def toggle_stack_membership(self): self.ui_state.stackSummaryChanged.emit() self.sync_ui_state() - def _reset_crop_settings(self): - """Resets crop settings to default (full image) and exits crop mode, and resets rotation.""" + def _reset_crop_only(self): + """Resets crop settings (crop box) to default and exits crop mode, PRESERVING rotation.""" if self.ui_state.isCropping: self.ui_state.isCropping = False self.update_status_message("Crop mode exited") self.ui_state.currentCropBox = (0, 0, 1000, 1000) # Also clear any editor-side crop box in case it's not fully synced yet self.image_editor.set_crop_box((0, 0, 1000, 1000)) + + def _reset_crop_settings(self): + """Resets crop settings (using _reset_crop_only) AND resets rotation.""" + self._reset_crop_only() # Reset rotation and straighten angle self.image_editor.set_edit_param("rotation", 0) self.image_editor.set_edit_param("straighten_angle", 0.0) @@ -6844,7 +6848,7 @@ def _apply_preview_result(self, payload): def cancel_crop_mode(self): """Cancel crop mode without applying changes.""" if self.ui_state.isCropping: - self._reset_crop_settings() + self._reset_crop_only() # Notify UI and kick fresh render self.ui_refresh_generation += 1 self._kick_preview_worker() @@ -6874,7 +6878,7 @@ def toggle_crop_mode(self): self.ui_state.isCropping = True # Reset to full image defaults (UI and Backend) - self._reset_crop_settings() + self._reset_crop_only() # Restore isCropping after helper might have cleared it (if it was somehow already True) self.ui_state.isCropping = True From c20d60265b85b5d616ab66389db99c13a2cc51e9 Mon Sep 17 00:00:00 2001 From: AlanRockefeller Date: Thu, 9 Apr 2026 01:18:22 -0700 Subject: [PATCH 4/4] Fix more crop bugs --- faststack/app.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/faststack/app.py b/faststack/app.py index efecee8..3b41459 100644 --- a/faststack/app.py +++ b/faststack/app.py @@ -3178,31 +3178,28 @@ def toggle_stack_membership(self): self.sync_ui_state() def _reset_crop_only(self): - """Resets crop settings (crop box) to default and exits crop mode, PRESERVING rotation.""" + """Resets crop settings (crop box and straighten) to default and exits crop mode, PRESERVING 90-deg rotation.""" if self.ui_state.isCropping: self.ui_state.isCropping = False self.update_status_message("Crop mode exited") self.ui_state.currentCropBox = (0, 0, 1000, 1000) # Also clear any editor-side crop box in case it's not fully synced yet self.image_editor.set_crop_box((0, 0, 1000, 1000)) + # Reset straighten angle since it is considered a crop-specific state + self.image_editor.set_edit_param("straighten_angle", 0.0) + if hasattr(self.ui_state, "cropRotation"): + self.ui_state.cropRotation = 0.0 + if "straighten_angle" in self.image_editor.current_edits: + self.image_editor.current_edits["straighten_angle"] = 0.0 def _reset_crop_settings(self): - """Resets crop settings (using _reset_crop_only) AND resets rotation.""" + """Resets crop settings (using _reset_crop_only) AND resets 90-degree rotation.""" self._reset_crop_only() - # Reset rotation and straighten angle + # Reset 90-degree rotation self.image_editor.set_edit_param("rotation", 0) - self.image_editor.set_edit_param("straighten_angle", 0.0) # Also update UI state for rotation values if they are exposed if hasattr(self.ui_state, "rotation"): self.ui_state.rotation = 0 - if hasattr( - self.ui_state, "cropRotation" - ): # This is used by Components.qml for the overlay - self.ui_state.cropRotation = 0.0 - - # Also reset the straighten angle in current_edits since it affects rotation logic - if "straighten_angle" in self.image_editor.current_edits: - self.image_editor.current_edits["straighten_angle"] = 0.0 @Slot() def launch_helicon_default(self): @@ -6876,10 +6873,9 @@ def toggle_crop_mode(self): if not self.load_image_for_editing(): return - self.ui_state.isCropping = True # Reset to full image defaults (UI and Backend) self._reset_crop_only() - # Restore isCropping after helper might have cleared it (if it was somehow already True) + # Set isCropping to True now that reset is done self.ui_state.isCropping = True self.ui_state.aspectRatioNames = [r["name"] for r in ASPECT_RATIOS]