[gimp/wip/Jehan/issue-498-quick-brush-edit: 44/48] app: fix switching seamlessly from constrained to unconstrained canvas…




commit 6357b216858e0ff07258752341c1fdf19a8ec74b
Author: Jehan <jehan girinstud io>
Date:   Fri Aug 12 01:03:56 2022 +0200

    app: fix switching seamlessly from constrained to unconstrained canvas…
    
    … rotation and back.

 app/display/gimpdisplayshell-tool-events.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 095f725ce8..b03a2b0125 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1126,7 +1126,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
             shell->picked_layer = NULL;
             shell->mod_action = GIMP_MODIFIER_ACTION_NONE;
           }
-        else if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE)
+        else if (shell->mod_action != GIMP_MODIFIER_ACTION_NONE &&
+                 (state & gimp_get_all_modifiers_mask ()) == 0)
           {
             gimp_display_shell_stop_scrolling (shell, event);
           }
@@ -1822,6 +1823,19 @@ gimp_display_shell_handle_scrolling (GimpDisplayShell *shell,
       else if (state == gimp_get_toggle_behavior_mask ())
         mod_action = GIMP_MODIFIER_ACTION_ZOOMING;
     }
+  else if (mod_action == GIMP_MODIFIER_ACTION_ROTATING ||
+           mod_action == GIMP_MODIFIER_ACTION_STEP_ROTATING)
+    {
+      state &= gimp_get_all_modifiers_mask ();
+
+      /* Allow switching from the constrained to non-constrained
+       * variant, back and forth, during a single scroll.
+       */
+      if (state == gimp_get_extend_selection_mask ())
+        mod_action = GIMP_MODIFIER_ACTION_ROTATING;
+      else if (state == (gimp_get_extend_selection_mask () | GDK_CONTROL_MASK))
+        mod_action = GIMP_MODIFIER_ACTION_STEP_ROTATING;
+    }
 
   switch (mod_action)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]