Protect setHightlightOnNodes against hover/click on POI (i.e. focus = entity = Node)
authorAndy Allan <gravitystorm@gmail.com>
Thu, 26 Aug 2010 15:10:24 +0000 (15:10 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Thu, 26 Aug 2010 15:10:24 +0000 (15:10 +0000)
TODO.txt
net/systemeD/potlatch2/controller/DrawWay.as

index 641e746..de462a0 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -41,7 +41,6 @@ Potlatch 2: main outstanding issues
 * Unexpected number of undo actions (3) when undoing drawway after adding a junction
 * GPS loading should have a loading... label
 * Pressing undo/redo sometimes doesn't change controllerstate. (e.g. create POI + undo leaves the tag panel still referring to POI)
-* sometimes triggering a null reference error within drawway (sethiglightonnodes)
 
 == Miscellaneous data model ==
 
index 3741626..a115d86 100644 (file)
@@ -61,7 +61,9 @@ package net.systemeD.potlatch2.controller {
                                                }
                                        } else {
                                                appendNode(entity as Node, MainUndoStack.getGlobalStack().addAction);
-                                               controller.map.setHighlightOnNodes(focus as Way, { hoverway: false });
+                                               if (focus is Way) {
+                          controller.map.setHighlightOnNodes(focus as Way, { hoverway: false });
+                        }
                                                controller.map.setHighlight(entity, { selectedway: true });
                                                resetElastic(entity as Node);
                                                lastClick=entity;
@@ -97,7 +99,7 @@ package net.systemeD.potlatch2.controller {
                                                  controller.map.coord2latp(event.localY));
                                elastic.end = mouse;
                        } else if ( event.type == MouseEvent.ROLL_OVER && !isBackground ) {
-                               if (focus!=selectedWay) {
+                               if (focus is Way && focus!=selectedWay) {
                                        hoverEntity=focus;
                                        controller.map.setHighlightOnNodes(focus as Way, { hoverway: true });
                                }
@@ -110,7 +112,7 @@ package net.systemeD.potlatch2.controller {
                                        controller.setCursor(controller.pen_plus);
                                }
                        } else if ( event.type == MouseEvent.MOUSE_OUT && !isBackground ) {
-                               if (entity!=selectedWay) {
+                               if (focus is Way && entity!=selectedWay) {
                                        hoverEntity=null;
                                        controller.map.setHighlightOnNodes(focus as Way, { hoverway: false });
                                        // ** We could do with an optional way of calling WayUI.redraw to only do the nodes, which would be a