Revision: 17703 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17703 Author: jesterking Date: 2008-12-03 21:57:23 +0100 (Wed, 03 Dec 2008)
Log Message: ----------- * make function to map mouse into region coords Modified Paths: -------------- branches/blender2.5/blender/source/blender/editors/interface/interface.c branches/blender2.5/blender/source/blender/editors/interface/interface.h branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.c =================================================================== --- branches/blender2.5/blender/source/blender/editors/interface/interface.c 2008-12-03 20:45:26 UTC (rev 17702) +++ branches/blender2.5/blender/source/blender/editors/interface/interface.c 2008-12-03 20:57:23 UTC (rev 17703) @@ -185,6 +185,12 @@ *y= (int)(fy+0.5f); } +void ui_window_to_region(const ARegion *ar, int *x, int *y) +{ + *x-= ar->winrct.xmin; + *y-= ar->winrct.ymin; +} + /* ******************* block calc ************************* */ /* only for pulldowns */ Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.h =================================================================== --- branches/blender2.5/blender/source/blender/editors/interface/interface.h 2008-12-03 20:45:26 UTC (rev 17702) +++ branches/blender2.5/blender/source/blender/editors/interface/interface.h 2008-12-03 20:57:23 UTC (rev 17703) @@ -244,6 +244,7 @@ extern void ui_block_to_window_rct(const struct ARegion *ar, uiBlock *block, rctf *graph, rcti *winr); extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y); extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y); +extern void ui_window_to_region(const ARegion *ar, int *x, int *y); extern double ui_get_but_val(uiBut *but); extern void ui_set_but_val(uiBut *but, double value); Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c =================================================================== --- branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c 2008-12-03 20:45:26 UTC (rev 17702) +++ branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c 2008-12-03 20:57:23 UTC (rev 17703) @@ -2595,8 +2595,10 @@ if(BLI_in_rcti(&ar->winrct, x, y)) { /* XXX still can be zero */ if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) { - /* mask is in different coord space - take that in account */ - return BLI_in_rcti(&ar->v2d.mask, x-ar->winrct.xmin, y-ar->winrct.ymin); + int arx = x; + int ary = y; + ui_window_to_region(ar, &arx, &ary); + return BLI_in_rcti(&ar->v2d.mask, arx, ary); } return 1; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs