squish a couple of redraw bugs
authorRichard Fairhurst <richard@systemed.net>
Sat, 10 Jul 2010 01:48:48 +0000 (01:48 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sat, 10 Jul 2010 01:48:48 +0000 (01:48 +0000)
TODO.txt
net/systemeD/halcyon/Map.as
net/systemeD/halcyon/MapPaint.as
net/systemeD/halcyon/connection/Connection.as
net/systemeD/potlatch2/controller/DragWay.as
net/systemeD/potlatch2/controller/DragWayNode.as
net/systemeD/potlatch2/controller/NoSelection.as
resources/map_features.xml
resources/potlatch.css

index 0320f60..9426746 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,10 +1,10 @@
 Potlatch 2: main outstanding issues
 -----------------------------------
-** = required before P2 goes live
 
 
 == Core geometry ==
 
+* purgeOutside simply doesn't work - WayUIs stay around. To investigate
 * P1-style J (join) / shift-J (unjoin)
 * Make parallelise properly undoable
 * Make Quadralatalawhatsit properly undoable
index 2a96928..b74bf9c 100755 (executable)
@@ -374,7 +374,7 @@ package net.systemeD.halcyon {
                        lastymouse=downY=mouseY;
                }
         
-               public function mouseUpHandler(event:MouseEvent):void {
+               public function mouseUpHandler(event:MouseEvent=null):void {
                        if (dragstate==DRAGGING) {
                                updateCoords(x,y);
                                updateEntityUIs(false, false);
index 8967131..e68d8e6 100644 (file)
@@ -132,6 +132,9 @@ package net.systemeD.halcyon {
                        if (!wayuis[way.id]) { return; }
                        wayuis[way.id].removeSprites();
                        delete wayuis[way.id];
+                       for (var i:uint=0; i<way.length; i++) {
+                               deleteNodeUI(way.getNode(i));
+                       }
                }
 
                public function deleteNodeUI(node:Node):void {
index 13ee98f..629fd7c 100755 (executable)
@@ -303,12 +303,14 @@ package net.systemeD.halcyon.connection {
         }
         
                public function purgeOutside(left:Number, right:Number, top:Number, bottom:Number):void {
+                       return;
+                       // ** this doesn't work - WayUIs stick around.
+                       // ** should purge POIs and relations too
                        for each (var way:Way in ways) {
                                if (!way.within(left,right,top,bottom) && !way.isDirty) {
                                        killWayWithNodes(way.id);
                                }
                        }
-                       // ** should purge POIs and relations too
                }
 
                public function markDirty():void {
index 0e6e811..fb67ca6 100644 (file)
@@ -51,6 +51,14 @@ package net.systemeD.potlatch2.controller {
                        }
         }
 
+               override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
+                       if (event.keyCode==27) {
+                               selectedWay.dispatchEvent(new WayDraggedEvent(Connection.WAY_DRAGGED, selectedWay, 0, 0));
+                               return new SelectedWay(selectedWay);
+                       }
+                       return this;
+               }
+
         private function dragTo(event:MouseEvent):ControllerState {
                        selectedWay.dispatchEvent(new WayDraggedEvent(Connection.WAY_DRAGGED, selectedWay, event.localX-downX, event.localY-downY));
             return this;
index e3d42d0..eb48f29 100644 (file)
@@ -12,6 +12,8 @@ package net.systemeD.potlatch2.controller {
 
         private var downX:Number;
         private var downY:Number;
+               private var originalLat:Number;
+               private var originalLon:Number;
                private var dragstate:uint=NOT_MOVED;
                private const NOT_DRAGGING:uint=0;
                private const NOT_MOVED:uint=1;
@@ -21,6 +23,8 @@ package net.systemeD.potlatch2.controller {
             selectedWay = way;
                        draggingIndex = index;
             draggingNode = way.getNode(index);
+                       originalLat = draggingNode.lat;
+                       originalLon = draggingNode.lon;
             downX = event.localX;
             downY = event.localY;
                        isNew = newNode;
@@ -62,6 +66,14 @@ package net.systemeD.potlatch2.controller {
                        }
         }
 
+               override public function processKeyboardEvent(event:KeyboardEvent):ControllerState {
+                       if (event.keyCode==27) {
+                               draggingNode.setLatLon( originalLat, originalLon, MainUndoStack.getGlobalStack().addAction );
+                       return new SelectedWayNode(selectedWay,draggingIndex);
+                       }
+                       return this;
+               }
+
         private function endDrag():ControllerState {
             return previousState;
         }
index d5290f4..aa12eab 100644 (file)
@@ -40,6 +40,7 @@ package net.systemeD.potlatch2.controller {
                }
                
         override public function enterState():void {
+                       controller.map.mouseUpHandler();
                        Globals.vars.root.addDebug("**** -> "+this);
         }
         override public function exitState(newState:ControllerState):void {
index 748b528..d314729 100644 (file)
     <tag k="tourism" v="viewpoint"/>
   </feature>
 
-  <feature name="Viewpoint">
+  <feature name="Zoo">
     <category>tourism</category><point /><inputSet ref="simpleName" />
        <icon image="features/pois/tourist_zoo.n.24.png"/>
     <tag k="tourism" v="zoo"/>
index c0d1619..2254f55 100644 (file)
@@ -14,7 +14,7 @@
   This is used as a debugger for finding unstyled areas; it's obviously oversimplistic since
   it picks up closed-loop highways. */
 
-way :area { color: red; width: 1; fill-color: red; fill-opacity: 0.5; }
+/* way :area { color: red; width: 1; fill-color: red; fill-opacity: 0.5; } */
 
 /* A set of fairly standard rules.
   We use z-index to make sure high-priority roads appear above minor ones.
@@ -26,7 +26,7 @@ way[highway=trunk],way[highway=trunk_link],
 way[highway=primary],way[highway=primary_link],
 way[highway=secondary],way[highway=secondary_link],
 way[highway=tertiary],way[highway=tertiary_link],
-way[highway=residential]                             { text: name; text-color: black; font-size: 7; text-position: line;}
+way[highway=residential]                             { text: name; text-color: black; font-size: 10; text-position: line; text-halo-color: white; text-halo-radius: 2; }
 way[highway=motorway],way[highway=motorway_link]    { z-index: 9; color: #809BC0; width: 7; casing-color: black; casing-width: 8; }
 way[highway=trunk],way[highway=trunk_link]          { z-index: 9; color: #7FC97F; width: 7; casing-color: black; casing-width: 8; }
 way[highway=primary],way[highway=primary_link]      { z-index: 8; color: #E46D71; width: 7; casing-color: black; casing-width: 8; }
@@ -90,7 +90,7 @@ node[amenity=police] { icon-image: icons/amenity_police2.n.16.png; z-index: 20;
 node[amenity=post_box] { icon-image: icons/amenity_post_box.n.16.png; z-index: 20; }
 node[amenity=recycling] { icon-image: icons/amenity_recycling.n.16.png; z-index: 20; }
 node[barrier=bollard] { icon-image: icons/barrier_bollard.n.16.png; z-index: 20; }
-node[barrier=gate], node[highway=gate] { icon-image: icons/barrier_gate.n.16.png; z-index: 20; }
+node[barrier=gate], node[highway=gate] { icon-image: icons/gate.png; z-index: 20; }
 node[barrier=toll_booth] { icon-image: icons/barrier_toll_booth.n.16.png; z-index: 20; }
 node[amenity=school] { icon-image: icons/education_school.n.16.png; text-offset:15; text: name; z-index: 20; }
 node[amenity=bar] { icon-image: icons/food_bar.n.16.png; text-offset:15; text: name; z-index: 20; }