fix creating ways duplicate node bug, and connecting to existing way-node bug
authorDave Stubbs <osm@randomjunk.co.uk>
Sun, 29 Nov 2009 19:33:31 +0000 (19:33 +0000)
committerDave Stubbs <osm@randomjunk.co.uk>
Sun, 29 Nov 2009 19:33:31 +0000 (19:33 +0000)
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/controller/CreateWay.as
net/systemeD/potlatch2/controller/DrawWay.as

index 6e83229bd5f29f8dbe8a1a5c1ccc171e5c383abb..a42e39f7056c3df23340eb933a7def0362a70c18 100644 (file)
@@ -10,10 +10,6 @@ package net.systemeD.potlatch2 {
 
         private var _map:Map;
         private var tagViewer:TagViewer;
-        private var selectedWay:Way;
-        private var selectedNode:Node;
-        
-        private var draggingNode:Node = null;
         
         private var state:ControllerState;
         private var _connection:Connection;
@@ -89,19 +85,6 @@ package net.systemeD.potlatch2 {
             state = newState;
             state.enterState();
         }
-
-        private function processNodeEvent(event:MouseEvent, entity:Entity):void {
-            if ( draggingNode != null ) {
-                if ( event.type == MouseEvent.MOUSE_UP ) {
-                    draggingNode = null;
-                } else if ( event.type == MouseEvent.MOUSE_MOVE ) {
-                    draggingNode.lat = map.coord2lat(event.localY);
-                    draggingNode.lon = map.coord2lon(event.localX);
-                }
-            } else if ( event.type == MouseEvent.MOUSE_DOWN ) {
-                draggingNode = entity as Node;
-            }
-        }
         
     }
 
index 9f239341e75c3b797a7cdbf7a763f85612f335fd..d8878bb09d0a853e5610e084c6b8d6c86413f654 100644 (file)
@@ -18,7 +18,7 @@ package net.systemeD.potlatch2.controller {
         
         override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
             var focus:Entity = NoSelection.getTopLevelFocusEntity(entity);
-            if ( event.type == MouseEvent.CLICK ) {
+            if ( event.type == MouseEvent.MOUSE_UP ) {
                 if ( focus == null ) {
                     var lat:Number = controller.map.coord2lat(event.localY);
                     var lon:Number = controller.map.coord2lon(event.localX);
index 934822b010699605d5a0c6e43c347dca67eee4bd..9932cfb3f286c1c15f21e556c8b418b2b8db2d8c 100644 (file)
@@ -18,16 +18,17 @@ package net.systemeD.potlatch2.controller {
                override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
                        var mouse:Point;
                        var node:Node;
-                       var focus:Entity = NoSelection.getTopLevelFocusEntity(entity);
-                       if ( event.type == MouseEvent.CLICK ) {
-                               if ( focus == null ) {
+
+                       if ( event.type == MouseEvent.MOUSE_UP ) {
+                               if ( entity == null ) {
                                        node = createAndAddNode(event);
                                        resetElastic(node);
-                               } else if ( focus is Node ) {
-                                       appendNode(focus as Node);
-                               } else if ( focus is Way ) {
+                               } else if ( entity is Node ) {
+                                       appendNode(entity as Node);
+                                       resetElastic(entity as Node);
+                               } else if ( entity is Way ) {
                                        node = createAndAddNode(event);
-                                       Way(focus).insertNodeAtClosestPosition(node, true);
+                                       Way(entity).insertNodeAtClosestPosition(node, true);
                                        resetElastic(node);
                                }
                        } else if ( event.type == MouseEvent.MOUSE_MOVE ) {