diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-11-10 15:53:05 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-11-11 12:12:28 +0300 |
commit | 2d48f3e445ad4294cfe1a354629bf335117ba40d (patch) | |
tree | dfb5f07db106891e32f2bc156451fad741781487 /source/blender/editors/space_outliner/outliner_select.c | |
parent | 12168ccf189df580b3a2ffd95bcc31a51c7d86a3 (diff) |
Fix 'outliner_scroll_view()' not reaching wanted element
Scrolling to an item after opening relevant parents can go wrong if said
parent e.g. the last in the list [as in: then the Outliner does not
scroll down all the way]
It stems from the fact that 'region->v2d.tot.ymin' is not up-to-date in
outliner_scroll_view after outliner_show_active opens up parents, 'tot'
will only update on a redraw.
Now calculate the trees height on the fly using
'outliner_tree_dimensions()'.
ref D9521
ref T82553
Maniphest Tasks: T82553
Differential Revision: https://developer.blender.org/D9523
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index aebb574578f..0a0b099eb5b 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1709,7 +1709,7 @@ static TreeElement *find_walk_select_start_element(SpaceOutliner *space_outliner } /* Scroll the outliner when the walk element reaches the top or bottom boundary */ -static void outliner_walk_scroll(ARegion *region, TreeElement *te) +static void outliner_walk_scroll(SpaceOutliner *space_outliner, ARegion *region, TreeElement *te) { /* Account for the header height */ int y_max = region->v2d.cur.ymax - UI_UNIT_Y; @@ -1717,10 +1717,10 @@ static void outliner_walk_scroll(ARegion *region, TreeElement *te) /* Scroll if walked position is beyond the border */ if (te->ys > y_max) { - outliner_scroll_view(region, te->ys - y_max); + outliner_scroll_view(space_outliner, region, te->ys - y_max); } else if (te->ys < y_min) { - outliner_scroll_view(region, -(y_min - te->ys)); + outliner_scroll_view(space_outliner, region, -(y_min - te->ys)); } } @@ -1747,7 +1747,7 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven OL_ITEM_SELECT | OL_ITEM_ACTIVATE | (extend ? OL_ITEM_EXTEND : 0)); /* Scroll outliner to focus on walk element */ - outliner_walk_scroll(region, active_te); + outliner_walk_scroll(space_outliner, region, active_te); ED_outliner_select_sync_from_outliner(C, space_outliner); outliner_tag_redraw_avoid_rebuild_on_open_change(space_outliner, region); |