don't deselect text when mouse pointer is aimlessly wandering around the map
authorRichard Fairhurst <richard@systemed.net>
Thu, 9 Dec 2010 14:45:13 +0000 (14:45 +0000)
committerRichard Fairhurst <richard@systemed.net>
Thu, 9 Dec 2010 14:45:13 +0000 (14:45 +0000)
net/systemeD/potlatch2/EditController.as

index 39c3d3e98d4e98a11de4bc1fa05b12bbb9cc527a..6b25d051ec1e379230450bc4121ddf0ea722a5de 100644 (file)
@@ -99,7 +99,7 @@ package net.systemeD.potlatch2 {
                }
 
         private function mapMouseEvent(event:MouseEvent):void {
                }
 
         private function mapMouseEvent(event:MouseEvent):void {
-            if (event.type!=MouseEvent.ROLL_OVER) map.stage.focus = map.parent;
+            if (isInteractionEvent(event)) map.stage.focus = map.parent;
             if (event.type==MouseEvent.MOUSE_UP && map.dragstate==map.DRAGGING) { return; }
             
             var mapLoc:Point = map.globalToLocal(new Point(event.stageX, event.stageY));
             if (event.type==MouseEvent.MOUSE_UP && map.dragstate==map.DRAGGING) { return; }
             
             var mapLoc:Point = map.globalToLocal(new Point(event.stageX, event.stageY));
@@ -111,8 +111,7 @@ package net.systemeD.potlatch2 {
         }
         
         public function entityMouseEvent(event:MouseEvent, entity:Entity):void {
         }
         
         public function entityMouseEvent(event:MouseEvent, entity:Entity):void {
-            if (event.type!=MouseEvent.ROLL_OVER) map.stage.focus = map.parent;
-            //if ( event.type == MouseEvent.MOUSE_DOWN )
+            if (isInteractionEvent(event)) map.stage.focus = map.parent;
             event.stopPropagation();
                 
             var mapLoc:Point = map.globalToLocal(new Point(event.stageX, event.stageY));
             event.stopPropagation();
                 
             var mapLoc:Point = map.globalToLocal(new Point(event.stageX, event.stageY));
@@ -122,7 +121,18 @@ package net.systemeD.potlatch2 {
             var newState:ControllerState = state.processMouseEvent(event, entity);
             setState(newState);
         }
             var newState:ControllerState = state.processMouseEvent(event, entity);
             setState(newState);
         }
-        
+
+               private function isInteractionEvent(event:MouseEvent):Boolean {
+                       switch (event.type) {
+                               case MouseEvent.ROLL_OUT:       return false;
+                               case MouseEvent.ROLL_OVER:      return false;
+                               case MouseEvent.MOUSE_OUT:      return false;
+                               case MouseEvent.MOUSE_OVER:     return false;
+                               case MouseEvent.MOUSE_MOVE:     return false;
+               }
+                       return true;
+               }
+
         public function setState(newState:ControllerState):void {
             if ( newState == state )
                 return;
         public function setState(newState:ControllerState):void {
             if ( newState == state )
                 return;