Author: clopes
Date: 2011-07-25 10:59:08 -0700 (Mon, 25 Jul 2011)
New Revision: 26260

Modified:
   cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
Log:
Fixes ticket #2539: Drag select then click = dblclick

Modified: 
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as  
2011-07-25 03:46:52 UTC (rev 26259)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/GraphMediator.as  
2011-07-25 17:59:08 UTC (rev 26260)
@@ -74,6 +74,7 @@
         // ========[ PRIVATE PROPERTIES 
]===========================================================
 
         private var _isMouseOverView:Boolean;
+        private var _mouseDownViewCounter:uint;
         private var _draggingNode:Boolean;
         private var _draggingGraph:Boolean;
         private var _draggingComponent:Boolean;
@@ -429,6 +430,8 @@
                 // DRAGGING the whole graph...
                 startDragGraph();
             } else if (!configProxy.grabToPanEnabled) {
+                _mouseDownViewCounter++;
+                
                 if (configProxy.mouseDownToDragDelay >= 0) {
                     _dragAllTimer = new 
Timer(configProxy.mouseDownToDragDelay, 1);
                     _dragAllTimer.addEventListener(TimerEvent.TIMER, 
function(te:TimerEvent):void {
@@ -488,11 +491,13 @@
         }
         
         private function onDoubleClickView(evt:MouseEvent):void { trace("* 
2-CLICK [View]");
-            if (!_shiftDown && configProxy.grabToPanEnabled)
-                sendNotification(ApplicationFacade.DESELECT_ALL);
-                
-            sendNotification(ApplicationFacade.DOUBLE_CLICK_EVENT,
-                             { mouseX: evt.stageX, mouseY: evt.stageY });
+            if (_mouseDownViewCounter > 1) {
+                if (!_shiftDown && configProxy.grabToPanEnabled)
+                    sendNotification(ApplicationFacade.DESELECT_ALL);
+                    
+                sendNotification(ApplicationFacade.DOUBLE_CLICK_EVENT,
+                                 { mouseX: evt.stageX, mouseY: evt.stageY });
+            }
         }
         
         private function onDragSelectionStart(evt:MouseEvent):void { trace("* 
Drag Selection START [View]");
@@ -501,6 +506,7 @@
             graphView.stage.addEventListener(MouseEvent.MOUSE_UP, 
onDragSelectionEnd, false, 0, true);
             graphView.stage.removeEventListener(MouseEvent.MOUSE_UP, 
onMouseUpToDeselect);
             graphView.stage.removeEventListener(MouseEvent.MOUSE_UP, 
onMouseUpToClick);
+            _mouseDownViewCounter = 0;
 
             // If SHIFT key is pressed, keep the previously selected elements.
             // Otherwise, deselect everything first:
@@ -755,6 +761,7 @@
         
         private function startDragGraph():void {
             _draggingGraph = true;
+            _mouseDownViewCounter = 0;
             updateCursor();
             selectionControl.enabled = false;
             vis.startDrag();

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to