diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 13:12:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 13:12:02 +0400 |
commit | a8ec2a536d419c178161a82b57bcca5e8cb6a218 (patch) | |
tree | 4369885cbf44711d204e49efc037dd61bc31017b | |
parent | 0af15a08da6c15d44ccc39ff7fe11d5be8627440 (diff) |
fix [#31476] DopeSheet GreasePencil Mode Window won't scroll up
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 76685b87f62..30adf79b362 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1478,6 +1478,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, View2DScrollers *scrollers; ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; + rctf tot_cur_union; float mask_size; /* set custom-data for operator */ @@ -1497,14 +1498,20 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, */ scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); + /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. + * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */ + tot_cur_union = v2d->tot; + BLI_rctf_union(&tot_cur_union, &v2d->cur); if (in_scroller == 'h') { /* horizontal scroller - calculate adjustment factor first */ mask_size = (float)BLI_rcti_size_x(&v2d->hor); - vsm->fac = BLI_rctf_size_x(&v2d->tot) / mask_size; + vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max); + vsm->zone = mouse_in_scroller_handle(event->mval[0], + v2d->hor.xmin, v2d->hor.xmax, + scrollers->hor_min, scrollers->hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1517,10 +1524,12 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, else { /* vertical scroller - calculate adjustment factor first */ mask_size = (float)BLI_rcti_size_y(&v2d->vert); - vsm->fac = BLI_rctf_size_y(&v2d->tot) / mask_size; + vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); + vsm->zone = mouse_in_scroller_handle(event->mval[1], + v2d->vert.ymin, v2d->vert.ymax, + scrollers->vert_min, scrollers->vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ |