UI: Fix animating panels after drag changing region size

The previous commit for this issue, 8e08d80e52, missed the case
where the panel animates to its aligned position when the mouse is
released.
This commit is contained in:
Hans Goudey 2020-04-30 14:21:14 -05:00
parent 713ad9d971
commit 1960b8a361
Notes: blender-bot 2023-02-13 22:41:05 +01:00
Referenced by commit 86bdc959a3, Fix T82417: Panels draw below others while animating after drag
Referenced by issue #76277, Enabling Viewer Border in Compositor Crashes Blender
1 changed files with 10 additions and 1 deletions

View File

@ -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);