diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-20 11:40:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-20 11:40:05 +0400 |
commit | 9f766c71b0a98801600c775dfc46faee84ddf49e (patch) | |
tree | e8d933e20df512eb836062e0f8cf9191f32c1141 /source/blender/editors/interface/view2d_ops.c | |
parent | 2338765726a5aa6b8870d573d685218720864583 (diff) |
use event->mval rather then subtracting ar->winrct.x / y from event->x / y
Diffstat (limited to 'source/blender/editors/interface/view2d_ops.c')
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 4cb67994704..f7bff168a33 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -702,7 +702,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event) /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -759,7 +759,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event) /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -936,7 +936,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -1286,7 +1286,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, ARegion *ar= CTX_wm_region(C); View2D *v2d= &ar->v2d; float mask_size; - int x, y; /* set custom-data for operator */ vsm= MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove"); @@ -1300,8 +1299,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, /* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */ vsm->lastx = event->x; vsm->lasty = event->y; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; /* 'zone' depends on where mouse is relative to bubble * - zooming must be allowed on this axis, otherwise, default to pan @@ -1313,7 +1310,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, vsm->fac= (v2d->tot.xmax - v2d->tot.xmin) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone= mouse_in_scroller_handle(x, 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 */ @@ -1328,7 +1325,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, vsm->fac= (v2d->tot.ymax - v2d->tot.ymin) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone= mouse_in_scroller_handle(y, 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 */ |