From d0c327c81c519aed6dcf19329c6e9daf0d87cc01 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 7 Dec 2011 09:55:37 +0000 Subject: Fix #29432: Marquee Select Bug Moved tweak threshold value to user preferences This threshold might be needed to be tweaked when working with tables, i.e. to prevent tap+slight movement be treated as tweak event. --- source/blender/editors/interface/resources.c | 2 ++ source/blender/makesdna/DNA_userdef_types.h | 4 +++- source/blender/makesrna/intern/rna_userdef.c | 5 +++++ source/blender/windowmanager/intern/wm_gesture.c | 3 +-- 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index dee945ecd7d..c3fe50edcd3 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1715,6 +1715,8 @@ void init_userdef_do_versions(void) U.ndof_flag = NDOF_LOCK_HORIZON | NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE; } + if (U.tweak_threshold == 0 ) + U.tweak_threshold= 10; /* funny name, but it is GE stuff, moves userdef stuff to engine */ // XXX space_set_commmandline_options(); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 4f6c7e22f5e..851d4b562e6 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -408,7 +408,9 @@ typedef struct UserDef { struct ColorBand coba_weight; /* from texture.h */ float sculpt_paint_overlay_col[3]; - int pad3; + + short tweak_threshold; + short pad3; char author[80]; /* author name for file formats supporting it */ } UserDef; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 0ea6b902150..f9b20d3ac78 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2929,6 +2929,11 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 3, 40); RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); + prop= RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "tweak_threshold"); + RNA_def_property_range(prop, 3, 1024); + RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered"); + /* 3D mouse settings */ /* global options */ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index ef463989c64..4fb8751de69 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -124,14 +124,13 @@ void WM_gestures_remove(bContext *C) /* tweak and line gestures */ -#define TWEAK_THRESHOLD 10 int wm_gesture_evaluate(wmGesture *gesture) { if(gesture->type==WM_GESTURE_TWEAK) { rcti *rect= gesture->customdata; int dx= rect->xmax - rect->xmin; int dy= rect->ymax - rect->ymin; - if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) { + if(ABS(dx)+ABS(dy) > U.tweak_threshold) { int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f); int val= EVT_GESTURE_W; -- cgit v1.2.3