diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-06-03 15:10:29 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-06-03 15:10:43 +0300 |
commit | 4d8ffa5ac5bb9346bdd7199da92386f7af7ed8ae (patch) | |
tree | 3bf0a4964d98c8572b0fd0faeb43d3342241f7b5 | |
parent | 24f625f345125e90a622b5ab8919f740b11fc1ce (diff) |
Fix T65328: Offset when outliner gains focus
I'm not actually not sure under which circumstances
this code is actually doing something useful.
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 4e4f25206a5..ee00c267352 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1839,7 +1839,6 @@ static void outliner_restore_scrolling_position(SpaceOutliner *soops, OutlinerTreeElementFocus *focus) { View2D *v2d = &ar->v2d; - int ytop; if (focus->tselem != NULL) { outliner_set_coordinates(ar, soops); @@ -1847,18 +1846,11 @@ static void outliner_restore_scrolling_position(SpaceOutliner *soops, TreeElement *te_new = outliner_find_tree_element(&soops->tree, focus->tselem); if (te_new != NULL) { - int ys_new, ys_old; + int ys_new = te_new->ys; + int ys_old = focus->ys; - ys_new = te_new->ys; - ys_old = focus->ys; - - ytop = v2d->cur.ymax + (ys_new - ys_old) - 1; - if (ytop > 0) { - ytop = 0; - } - - v2d->cur.ymax = (float)ytop; - v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask)); + float y_move = MIN2(ys_new - ys_old, -v2d->cur.ymax); + BLI_rctf_translate(&v2d->cur, 0, y_move); } else { return; |