[Bf-blender-cvs] [1960b8a361e] master: UI: Fix animating panels after drag changing region size

Hans Goudey noreply at git.blender.org
Thu Apr 30 21:21:48 CEST 2020


Commit: 1960b8a361eedf2f1717e8525c54de21d6ac7d82
Author: Hans Goudey
Date:   Thu Apr 30 14:21:14 2020 -0500
Branches: master
https://developer.blender.org/rB1960b8a361eedf2f1717e8525c54de21d6ac7d82

UI: Fix animating panels after drag changing region size

The previous commit for this issue, 8e08d80e52d6, missed the case
where the panel animates to its aligned position when the mouse is
released.

===================================================================

M	source/blender/editors/interface/interface_panel.c

===================================================================

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 911250891f0..04179721305 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -102,6 +102,7 @@ typedef struct uiHandlePanelData {
   double starttime;
 
   /* dragging */
+  bool is_drag_drop;
   int startx, starty;
   int startofsx, startofsy;
   int startsizex, startsizey;
@@ -883,7 +884,7 @@ bool UI_panel_is_dragging(const struct Panel *panel)
     return false;
   }
 
-  return (data->state == PANEL_STATE_DRAG);
+  return data->is_drag_drop;
 }
 
 typedef struct PanelSort {
@@ -2496,6 +2497,8 @@ static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelS
     return;
   }
 
+  bool was_drag_drop = (data && data->state == PANEL_STATE_DRAG);
+
   if (state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
     if (data && data->state != PANEL_STATE_ANIMATION) {
       /* XXX:
@@ -2547,6 +2550,12 @@ static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelS
     data->startsizex = panel->sizex;
     data->startsizey = panel->sizey;
     data->starttime = PIL_check_seconds_timer();
+
+    /* Remember drag drop state even when animating to the aligned position after dragging. */
+    data->is_drag_drop = was_drag_drop;
+    if (state == PANEL_STATE_DRAG) {
+      data->is_drag_drop = true;
+    }
   }
 
   ED_region_tag_redraw(region);



More information about the Bf-blender-cvs mailing list