custom mouse pointers when drawing way
authorRichard Fairhurst <richard@systemed.net>
Thu, 10 Jun 2010 18:58:08 +0000 (18:58 +0000)
committerRichard Fairhurst <richard@systemed.net>
Thu, 10 Jun 2010 18:58:08 +0000 (18:58 +0000)
TODO.txt
embedded/pen.png [new file with mode: 0644]
embedded/pen_o.png [new file with mode: 0644]
embedded/pen_plus.png [new file with mode: 0644]
embedded/pen_so.png [new file with mode: 0644]
embedded/pen_x.png [new file with mode: 0644]
net/systemeD/halcyon/connection/Way.as
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/controller/DrawWay.as

index 4c0c860..42551c8 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,12 +1,13 @@
 Potlatch 2: main outstanding issues
 -----------------------------------
+** = required before P2 goes live
 
 == Core geometry ==
 
+** Straighten way + undo + redo looks fine in the UI, but doesn't reinsert the nodes into the way properly when saving (maybe way isn't dirty?)
 * Make parallelise properly undoable
 * Make Quadralatalawhatsit properly undoable
 * Splitway + undo leaves way marked dirty
-* Straighten way + undo + redo looks fine in the UI, but doesn't reinsert the nodes into the way properly when saving (maybe way isn't dirty?)
 
 == Vector background layers ==
 
@@ -20,16 +21,16 @@ Potlatch 2: main outstanding issues
 
 == Saving ==
 
-* Comment and advanced -> "comment" should show the same thing
+** Comment and advanced -> "comment" should show the same thing
 * Save should be deactivated until there's things to change
 * Should be able to reuse changesets
 * Shouldn't be able to change created_by and version on changeset
 
 == Tag editing ==
 
-* Doesn't always update selected tab when you select a new entity
-* 'Add to route' in relations doesn't work
-* Direct click-to-edit of relation role should actually work
+** Doesn't always update selected tab when you select a new entity
+** 'Add to route' in relations doesn't work
+** Direct click-to-edit of relation role should actually work
 * Dynamic reloading of stylesheet/map_features, so that you don't need to reload the full page when editing them
 * If a select name is too long then, the select menu seems to give a horizontal scrollbar instead of the name of the item e.g. cuisine#Coffee Shop
 * If you have both inputSets names and buildingAddress, and name= key is filled in then the basic tab will get both, surely only name should be shown and building name should be ignored e.g. cafes. [Actually this was an issue of addr: being missing from one of them, however this may still be a problem for other overlapping inputSets]
@@ -43,21 +44,19 @@ Potlatch 2: main outstanding issues
 
 == UI ==
 
-* Parallelise should use the distance from the way, not from the first click (needs someone good at maths to fix this)
-* Potlatch 1-style "floaty warnings"
-* Keyboard shortcuts
+** Parallelise should use the distance from the way, not from the first click (needs someone good at maths to fix this)
+** Potlatch 1-style "floaty warnings"
+** Toolbox fixes (see comments in file)
+** Should remember which background imagery layer you had previously selected
+** Background imagery layers should match those of p1
+** Dialog for adding custom imagery url
+** Dragging a node under the toolbox and then mouseuping doesn't get passed to the map, so you end up with a node "stuck" to the pointer
+** onDataComplete fires the first time a map call has returned - but multiple calls might have been made, so really we should count them and only reset dataWorking when it's back to 0 again
 * Mouse wheel zooming
 * CSS editing
-* Toolbox fixes (see comments in file)
 * Quick-search on add-relations-to-way dialog (RelationSelectPanel)
 * Bug: when drawing way, escape ends drawing. Should revert to previous way.
-* Mouse icon should indicate when a join is being made (blue nodes might not be visible)
 * i18n
-* Should remember which background imagery layer you had previously selected
-* Background imagery layers should match those of p1
-* Dialog for adding custom imagery url
-* Draggin a node under the toolbox and then mouseuping doesn't get passed to the map, so you end up with a node "stuck" to the pointer
-* onDataComplete fires the first time a map call has returned - but multiple calls might have been made, so really we should count them and only reset dataWorking when it's back to 0 again
 
 == Miscellaneous data model ==
 
@@ -66,9 +65,10 @@ Potlatch 2: main outstanding issues
 
 == Rendering (Halcyon) ==
 
-* Changing style, and then back again, doesn't redraw everything
+** Changing style, and then back again, doesn't redraw everything
+** Centred area text isn't really centred (bottom left remains constant)
+** Infinite z-indexes
 * Shields
 * More line decoration (cliffs etc.), and implied values for 'dashes' if not supplied
 * Complete MapCSS support
 * 'Light' version without vectorlayer support etc.
-* Infinite z-indexes
diff --git a/embedded/pen.png b/embedded/pen.png
new file mode 100644 (file)
index 0000000..60d3898
Binary files /dev/null and b/embedded/pen.png differ
diff --git a/embedded/pen_o.png b/embedded/pen_o.png
new file mode 100644 (file)
index 0000000..d35db59
Binary files /dev/null and b/embedded/pen_o.png differ
diff --git a/embedded/pen_plus.png b/embedded/pen_plus.png
new file mode 100644 (file)
index 0000000..286b8cd
Binary files /dev/null and b/embedded/pen_plus.png differ
diff --git a/embedded/pen_so.png b/embedded/pen_so.png
new file mode 100644 (file)
index 0000000..30f379e
Binary files /dev/null and b/embedded/pen_so.png differ
diff --git a/embedded/pen_x.png b/embedded/pen_x.png
new file mode 100644 (file)
index 0000000..1d3fce0
Binary files /dev/null and b/embedded/pen_x.png differ
index 4f4c06c..ebf131c 100644 (file)
@@ -170,6 +170,10 @@ package net.systemeD.halcyon.connection {
                        return (nodes[0].id==nodes[nodes.length-1].id && nodes.length>2);
                }
                
+               public function endsWith(node:Node):Boolean {
+                       return (nodes[0]==node || nodes[nodes.length-1]==node);
+               }
+               
                public override function remove(performAction:Function):void {
                        performAction(new DeleteWayAction(this, setDeletedState, nodes));
                }
index f0249f5..7715f26 100644 (file)
@@ -3,6 +3,7 @@ package net.systemeD.potlatch2 {
     import net.systemeD.halcyon.MapController;
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.potlatch2.controller.*;
+       import mx.managers.CursorManager;
        import flash.events.*;
        import flash.geom.*;
 
@@ -18,6 +19,12 @@ package net.systemeD.potlatch2 {
                private var keys:Object={};
                public var clipboards:Object={};
 
+               [Embed(source="../../../embedded/pen.png")]             public var pen:Class;
+               [Embed(source="../../../embedded/pen_x.png")]           public var pen_x:Class;
+               [Embed(source="../../../embedded/pen_o.png")]           public var pen_o:Class;
+               [Embed(source="../../../embedded/pen_so.png")]          public var pen_so:Class;
+               [Embed(source="../../../embedded/pen_plus.png")]        public var pen_plus:Class;
+               
         public function EditController(map:Map, tagViewer:TagViewer, toolbox:Toolbox) {
             this._map = map;
             this.tagViewer = tagViewer;
@@ -102,6 +109,11 @@ package net.systemeD.potlatch2 {
             state.enterState();
         }
 
+               public function setCursor(cursor:Class):void {
+                       CursorManager.removeAllCursors();
+                       if (cursor) { CursorManager.setCursor(cursor); }
+               }
+
     }
 
     
index 6819ac5..f0dca94 100644 (file)
@@ -77,20 +77,33 @@ package net.systemeD.potlatch2.controller {
                                                  controller.map.coord2lon(event.localX),
                                                  controller.map.coord2latp(event.localY));
                                elastic.end = mouse;
-                       } else if ( event.type == MouseEvent.ROLL_OVER && focus!=selectedWay) {
-                               hoverEntity=focus;
-                               controller.map.setHighlight(focus, { showNodesHover: true });
-                       } else if ( event.type == MouseEvent.MOUSE_OUT  && focus!=selectedWay) {
-                               hoverEntity=null;
-                               controller.map.setHighlight(focus, { showNodesHover: false });
-                               controller.map.setHighlight(selectedWay, { showNodes: true });
-                               // ** this call to setHighlight(selectedWay) is necessary in case the hovered way (blue nodes)
-                               // shares any nodes with the selected way (red nodes): if they do, they'll be wiped out by the
-                               // first call.
-                               // Ultimately we should fix this by referring to 'way :selected nodes' instead of 'nodes :selectedway'.
-                               // But this will do for now.
-                               // We could do with an optional way of calling WayUI.redraw to only do the nodes, which would be a
-                               // useful optimisation.
+                       } else if ( event.type == MouseEvent.ROLL_OVER ) {
+                               if (focus!=selectedWay) {
+                                       hoverEntity=focus;
+                                       controller.map.setHighlight(focus, { showNodesHover: true });
+                               }
+                               if (entity is Node && Way(focus).endsWith(Node(entity))) {
+                                       if (focus==selectedWay) { controller.setCursor(controller.pen_so); }
+                                                          else { controller.setCursor(controller.pen_o); }
+                               } else if (entity is Node) {
+                                       controller.setCursor(controller.pen_x);
+                               } else {
+                                       controller.setCursor(controller.pen_plus);
+                               }
+                       } else if ( event.type == MouseEvent.MOUSE_OUT ) {
+                               if (focus!=selectedWay) {
+                                       hoverEntity=null;
+                                       controller.map.setHighlight(focus, { showNodesHover: false });
+                                       controller.map.setHighlight(selectedWay, { showNodes: true });
+                                       // ** this call to setHighlight(selectedWay) is necessary in case the hovered way (blue nodes)
+                                       // shares any nodes with the selected way (red nodes): if they do, they'll be wiped out by the
+                                       // first call.
+                                       // Ultimately we should fix this by referring to 'way :selected nodes' instead of 'nodes :selectedway'.
+                                       // But this will do for now.
+                                       // We could do with an optional way of calling WayUI.redraw to only do the nodes, which would be a
+                                       // useful optimisation.
+                               }
+                               controller.setCursor(controller.pen);
                        }
 
                        return this;
@@ -180,10 +193,12 @@ package net.systemeD.potlatch2.controller {
                        var node:Node = selectedWay.getNode(editEnd ? selectedWay.length - 1 : 0);
                        var start:Point = new Point(node.lon, node.latp);
                        elastic = new Elastic(controller.map, start, start);
+                       controller.setCursor(controller.pen);
                        Globals.vars.root.addDebug("**** -> "+this);
                }
                override public function exitState():void {
                        super.exitState();
+                       controller.setCursor(null);
                        elastic.removeSprites();
                        elastic = null;
                        Globals.vars.root.addDebug("**** <- "+this);