From 3535d0f58a6f67b216d3d678e33eefb37dee2080 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 26 Aug 2010 15:10:24 +0000 Subject: [PATCH] Protect setHightlightOnNodes against hover/click on POI (i.e. focus = entity = Node) --- TODO.txt | 1 - net/systemeD/potlatch2/controller/DrawWay.as | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO.txt b/TODO.txt index 641e7468..de462a0b 100644 --- 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 == diff --git a/net/systemeD/potlatch2/controller/DrawWay.as b/net/systemeD/potlatch2/controller/DrawWay.as index 3741626d..a115d86d 100644 --- a/net/systemeD/potlatch2/controller/DrawWay.as +++ b/net/systemeD/potlatch2/controller/DrawWay.as @@ -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 -- 2.31.1