Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-20 11:40:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-20 11:40:05 +0400
commit9f766c71b0a98801600c775dfc46faee84ddf49e (patch)
treee8d933e20df512eb836062e0f8cf9191f32c1141 /source/blender/editors/animation
parent2338765726a5aa6b8870d573d685218720864583 (diff)
use event->mval rather then subtracting ar->winrct.x / y from event->x / y
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_ops.c9
2 files changed, 4 insertions, 13 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 4edcca46935..f755df79986 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2148,7 +2148,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
bAnimContext ac;
ARegion *ar;
View2D *v2d;
- int mval[2], channel_index;
+ int channel_index;
int notifierFlags = 0;
short selectmode;
float x, y;
@@ -2162,10 +2162,6 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
ar= ac.ar;
v2d= &ar->v2d;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -2179,7 +2175,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
* ACHANNEL_HEIGHT_HALF.
*/
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index ff9521f1ebd..93d99c59a0e 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -107,14 +107,9 @@ static int frame_from_event(bContext *C, wmEvent *event)
{
ARegion *region= CTX_wm_region(C);
float viewx;
- int x, y;
-
- /* convert screen coordinates to region coordinates */
- x= event->x - region->winrct.xmin;
- y= event->y - region->winrct.ymin;
-
+
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&region->v2d, x, y, &viewx, NULL);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, NULL);
/* round result to nearest int (frames are ints!) */
return (int)floor(viewx+0.5f);