Skip to content

Commit

Permalink
make sure DrawLine mode is called with a clean pre-operation graph
Browse files Browse the repository at this point in the history
closes #2303
  • Loading branch information
tyrasd committed Jan 26, 2016
1 parent 08f6bbc commit 9c37ead
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/id/modes/add_line.js
Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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() {
Expand Down

0 comments on commit 9c37ead

Please sign in to comment.