fix creating ways duplicate node bug, and connecting to existing way-node bug
[potlatch2.git] / net / systemeD / potlatch2 / controller / CreateWay.as
index 91862e29480fd61024954dabe25efd11d2f128a9..d8878bb09d0a853e5610e084c6b8d6c86413f654 100644 (file)
@@ -4,6 +4,7 @@ package net.systemeD.potlatch2.controller {
     import net.systemeD.potlatch2.EditController;
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.Elastic;
+       import net.systemeD.halcyon.Globals;
 
     public class CreateWay extends ControllerState {
         private var start:Point;
@@ -17,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);
@@ -54,11 +55,13 @@ package net.systemeD.potlatch2.controller {
             mouse.y = controller.map.coord2latp(mouse.y);
             
             elastic = new Elastic(controller.map, start, mouse);
+                       Globals.vars.root.addDebug("**** -> "+this);
         }
         
         override public function exitState():void {
             elastic.removeSprites();
             elastic = null;
+                       Globals.vars.root.addDebug("**** <- "+this);
         }
 
         override public function toString():String {