Don't allow parallelise keypress to return 0-length ways
[potlatch2.git] / net / systemeD / potlatch2 / controller / SelectedParallelWay.as
index 1324af138aab194b0ab88d34c04aee86dc712c2c..8ff494c41c8364e7cae4befb5f8fa69d029ff375 100644 (file)
@@ -21,11 +21,12 @@ package net.systemeD.potlatch2.controller {
         }
 
         override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
-                       if (event.type==MouseEvent.MOUSE_MOVE) {
+                       if (event.type==MouseEvent.MOUSE_MOVE || event.type==MouseEvent.MOUSE_UP) {
                                var lon:Number =controller.map.coord2lon(controller.map.mouseX);
                                var latp:Number=controller.map.coord2latp(controller.map.mouseY);
                                parallelise.draw(distanceFromWay(lon,latp));
-                       } else if (event.type==MouseEvent.MOUSE_UP) {
+                       }
+                       if (event.type==MouseEvent.MOUSE_UP) {
                                return new SelectedWay(firstSelected as Way);
                        }
                        return this;
@@ -76,7 +77,7 @@ package net.systemeD.potlatch2.controller {
                /** Creates the WayUI for the parallel way. */
                override public function enterState():void {
                        selection=[parallelise.parallelWay];
-                       editableLayer.createWayUI(firstSelected as Way);
+                       layer.createWayUI(firstSelected as Way);
                        startlon =controller.map.coord2lon(controller.map.mouseX);
                        startlatp=controller.map.coord2latp(controller.map.mouseY);
         }