From: Richard Fairhurst Date: Thu, 9 Dec 2010 14:45:13 +0000 (+0000) Subject: don't deselect text when mouse pointer is aimlessly wandering around the map X-Git-Tag: 2.0~231 X-Git-Url: https://git.openstreetmap.org/potlatch2.git/commitdiff_plain/12e02d2274718fe8ae436bec7ddb74f93246957b don't deselect text when mouse pointer is aimlessly wandering around the map --- diff --git a/net/systemeD/potlatch2/EditController.as b/net/systemeD/potlatch2/EditController.as index 39c3d3e9..6b25d051 100644 --- a/net/systemeD/potlatch2/EditController.as +++ b/net/systemeD/potlatch2/EditController.as @@ -99,7 +99,7 @@ package net.systemeD.potlatch2 { } 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)); @@ -111,8 +111,7 @@ package net.systemeD.potlatch2 { } 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)); @@ -122,7 +121,18 @@ package net.systemeD.potlatch2 { 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;