From 9c37ead08d5d8118d0a9174709b08606654c8707 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 26 Jan 2016 12:52:46 +0100 Subject: [PATCH] make sure DrawLine mode is called with a clean pre-operation graph closes #2303 --- js/id/modes/add_line.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/id/modes/add_line.js b/js/id/modes/add_line.js index 8132dcb58..3dc014c72 100644 --- a/js/id/modes/add_line.js +++ b/js/id/modes/add_line.js @@ -14,7 +14,7 @@ iD.modes.AddLine = function(context) { .on('startFromNode', startFromNode); function start(loc) { - var graph = context.graph(), + var baseGraph = context.graph(), node = iD.Node({loc: loc}), way = iD.Way(); @@ -23,11 +23,11 @@ iD.modes.AddLine = function(context) { iD.actions.AddEntity(way), iD.actions.AddVertex(way.id, node.id)); - context.enter(iD.modes.DrawLine(context, way.id, graph)); + context.enter(iD.modes.DrawLine(context, way.id, baseGraph)); } function startFromWay(loc, edge) { - var graph = context.graph(), + var baseGraph = context.graph(), node = iD.Node({loc: loc}), way = iD.Way(); @@ -37,17 +37,18 @@ iD.modes.AddLine = function(context) { iD.actions.AddVertex(way.id, node.id), iD.actions.AddMidpoint({ loc: loc, edge: edge }, node)); - context.enter(iD.modes.DrawLine(context, way.id, graph)); + context.enter(iD.modes.DrawLine(context, way.id, baseGraph)); } function startFromNode(node) { - var way = iD.Way(); + var baseGraph = context.graph(), + way = iD.Way(); context.perform( iD.actions.AddEntity(way), iD.actions.AddVertex(way.id, node.id)); - context.enter(iD.modes.DrawLine(context, way.id, context.graph())); + context.enter(iD.modes.DrawLine(context, way.id, baseGraph)); } mode.enter = function() {