From a7bc5d367bdb759bbfbc806baf34d2790ff2a89c Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 13 May 2013 10:29:31 -0700 Subject: [PATCH] Fix area drawing --- js/id/behavior/draw_way.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 9d49c5115..b51341893 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -26,21 +26,23 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { } function move(datum) { - var loc = context.map().mouseCoordinates(); + var loc; - if (datum.id === end.id || datum.id === segment.id) { - context.surface().selectAll('.way, .node') - .filter(function(d) { - return d.id === end.id || d.id === segment.id; - }) - .classed('active', true); - } else if (datum.type === 'node') { + if (datum.type === 'node' && datum.id !== end.id) { loc = datum.loc; - } else if (datum.type === 'way') { + } else if (datum.type === 'way' && datum.id !== segment.id) { loc = iD.geo.chooseEdge(context.childNodes(datum), context.mouse(), context.projection).loc; + } else { + loc = context.map().mouseCoordinates(); } context.replace(iD.actions.MoveNode(end.id, loc)); + + context.surface().selectAll('.way, .node') + .filter(function(d) { + return d.id === end.id || d.id === segment.id; + }) + .classed('active', true); } function undone() {