[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59794] trunk/blender/source/blender/ editors: fix for window join action being interpreted as a split.

Campbell Barton ideasman42 at gmail.com
Wed Sep 4 07:06:38 CEST 2013


Revision: 59794
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59794
Author:   campbellbarton
Date:     2013-09-04 05:06:38 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
fix for window join action being interpreted as a split.

The limit for dragging a gesture on an area corner was smaller then the area hot-spot,
so you could click on the right-most side of the bottom-left corner, drag left - pass the gesture threshold and still be in the same area. so a motion intended as a join would register as a split.
Happened more with high DPI values. fix by ensuring the drag limit is always higher then the hotspot.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_screen_types.h
    trunk/blender/source/blender/editors/screen/screen_ops.c

Modified: trunk/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen_types.h	2013-09-04 03:52:25 UTC (rev 59793)
+++ trunk/blender/source/blender/editors/include/ED_screen_types.h	2013-09-04 05:06:38 UTC (rev 59794)
@@ -79,7 +79,7 @@
 	AE_RIGHT_TO_TOPLEFT,    /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */
 	AE_LEFT_TO_TOPRIGHT,    /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */
 	AE_TOP_TO_BOTTOMRIGHT,  /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */
-	AE_BOTTOM_TO_TOPLEFT    /* Region located at the top, _bottom_edge is action zone. Region minimized to the top left */
+	AE_BOTTOM_TO_TOPLEFT    /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */
 } AZEdge;
 
 /* for editing areas/regions */
@@ -87,10 +87,8 @@
 	struct AZone *next, *prev;
 	ARegion *ar;
 	int type;
-	/* region-azone, which of the edges */
+	/* region-azone, which of the edges (only for AZONE_REGION) */
 	AZEdge edge;
-	/* internal */
-	short do_draw;
 	/* for draw */
 	short x1, y1, x2, y2;
 	/* for clip */

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2013-09-04 03:52:25 UTC (rev 59793)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2013-09-04 05:06:38 UTC (rev 59794)
@@ -696,26 +696,29 @@
 static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	sActionzoneData *sad = op->customdata;
-	int deltax, deltay;
-	int mindelta = sad->az->type == AZONE_REGION ? 1 : 12;
 	
 	switch (event->type) {
 		case MOUSEMOVE:
+		{
+			/* for AZONE_AREA 'delta_min' uses (AZONESPOT + 1) dragging before a gesture is accepted.
+			 * because the distance must be larger then the hot-spot else an intended join can turn into a split */
+			const int delta_min = (sad->az->type == AZONE_AREA) ? (AZONESPOT + 1) : 1;
+
+			const int delta_x = (event->x - sad->x);
+			const int delta_y = (event->y - sad->y);
+
 			/* calculate gesture direction */
-			deltax = (event->x - sad->x);
-			deltay = (event->y - sad->y);
-			
-			if (deltay > ABS(deltax))
+			if (delta_y > ABS(delta_x))
 				sad->gesture_dir = 'n';
-			else if (deltax > ABS(deltay))
+			else if (delta_x > ABS(delta_y))
 				sad->gesture_dir = 'e';
-			else if (deltay < -ABS(deltax))
+			else if (delta_y < -ABS(delta_x))
 				sad->gesture_dir = 's';
 			else
 				sad->gesture_dir = 'w';
 			
 			/* gesture is large enough? */
-			if (ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
+			if (ABS(delta_x) > delta_min || ABS(delta_y) > delta_min) {
 				
 				/* second area, for join */
 				sad->sa2 = screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
@@ -726,6 +729,7 @@
 				return OPERATOR_FINISHED;
 			}
 			break;
+		}
 		case ESCKEY:
 			actionzone_exit(op);
 			return OPERATOR_CANCELLED;




More information about the Bf-blender-cvs mailing list