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/uvedit | |
parent | 2338765726a5aa6b8870d573d685218720864583 (diff) |
use event->mval rather then subtracting ar->winrct.x / y from event->x / y
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 20d7ea21d5c..1ea2db4c237 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1715,12 +1715,8 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); float co[2]; - int x, y; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - - UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]); + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); return select_exec(C, op); @@ -1764,12 +1760,8 @@ static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); float co[2]; - int x, y; - - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]); + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); return select_loop_exec(C, op); @@ -1825,12 +1817,8 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i if(event) { /* invoke */ ARegion *ar= CTX_wm_region(C); - int x, y; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - - UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]); + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); RNA_float_set_array(op->ptr, "location", co); } else { @@ -3036,12 +3024,9 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op) static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - int x, y; float location[2]; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - UI_view2d_region_to_view(&ar->v2d, x, y, &location[0], &location[1]); + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); RNA_float_set_array(op->ptr, "location", location); return set_2d_cursor_exec(C, op); @@ -3092,14 +3077,12 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event) Image *ima= CTX_data_edit_image(C); ARegion *ar= CTX_wm_region(C); float fx, fy; - int x, y, tile[2]; + int tile[2]; if(!ima || !(ima->tpageflag & IMA_TILES)) return OPERATOR_CANCELLED; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - UI_view2d_region_to_view(&ar->v2d, x, y, &fx, &fy); + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy); if(fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { fx= fx*ima->xrep; |