Fix issue with intersections only being added to the topmost way
[potlatch2.git] / net / systemeD / potlatch2 / controller / DrawWay.as
index f8811f9db1ef51b8eda0dcb723ccd2be6d06350a..d1ea59a7cf2e07af2ecf4e7641ccdd94de5f176e 100644 (file)
@@ -101,8 +101,9 @@ package net.systemeD.potlatch2.controller {
                                        } else {
                         // add junction node - another way
                         var jnct:CompositeUndoableAction = new CompositeUndoableAction("Junction Node");
+                        var ways:Array = layer.findWaysAtPoint(event.stageX, event.stageY, selectedWay);
                         node = createAndAddNode(event, jnct.push);
-                        Way(entity).insertNodeAtClosestPosition(node, true, jnct.push);
+                        for each (var w:Way in ways) { w.insertNodeAtClosestPosition(node, true, jnct.push); }
                         MainUndoStack.getGlobalStack().addAction(jnct);
                         layer.setHighlight(node, { selectedway: true });
                         layer.setPurgable([node], false);