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 6e83229..a42e39f 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 9f23934..d8878bb 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 934822b..9932cfb 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 ) {