Page MenuHome
Paste P3208

Fix T72392: Resizing Outliner moves the scroll position
ArchivedPublic

Authored by Campbell Barton (campbellbarton) on Sep 22 2022, 7:42 AM.
commit 1ec2a776bde15fc2748979f01c037cf857c737fa
Author: Campbell Barton <campbell@blender.org>
Date: Thu Sep 22 15:37:55 2022 +1000
Fix T72392: Resizing Outliner moves the scroll position
Enable V2D_KEEPOFS_X/Y for V2D_COMMONVIEW_STACK & V2D_COMMONVIEW_HEADER.
diff --git a/source/blender/editors/interface/view2d.cc b/source/blender/editors/interface/view2d.cc
index 95e5c0ad7d8..b6cbb2c5859 100644
--- a/source/blender/editors/interface/view2d.cc
+++ b/source/blender/editors/interface/view2d.cc
@@ -278,6 +278,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
v2d->keeptot = V2D_KEEPTOT_STRICT;
+ v2d->keepofs = (V2D_KEEPOFS_X | V2D_KEEPOFS_Y);
tot_changed = do_init;
/* scroller settings are currently not set here... that is left for regions... */
@@ -303,6 +304,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
/* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
v2d->keeptot = V2D_KEEPTOT_STRICT;
+ v2d->keepofs = (V2D_KEEPOFS_X | V2D_KEEPOFS_Y);
tot_changed = do_init;
/* panning in y-axis is prohibited */
@@ -534,7 +536,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
/* do_win = do_y; */ /* UNUSED */
if (do_cur) {
- if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && (winx != v2d->oldwinx)) {
+ if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && ((v2d->keepofs & V2D_KEEPOFS_X) == 0) &&
+ (winx != v2d->oldwinx)) {
/* Special exception for Outliner (and later channel-lists):
* - The view may be moved left to avoid contents
* being pushed out of view when view shrinks.
@@ -559,7 +562,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
}
}
else {
- if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && (winy != v2d->oldwiny)) {
+ if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && ((v2d->keepofs & V2D_KEEPOFS_Y) == 0) &&
+ (winy != v2d->oldwiny)) {
/* special exception for Outliner (and later channel-lists):
* - Currently, no actions need to be taken here...
*/

Event Timeline

Campbell Barton (campbellbarton) changed the title of this paste from untitled to Fix T72392: Resizing Outliner moves the scroll position.