Skip to content

Commit

Permalink
Prevent creation of ways with duplicate nodes
Browse files Browse the repository at this point in the history
Related to #1249
  • Loading branch information
ansis committed Apr 5, 2013
1 parent 6a60ea9 commit a8f41b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/id/behavior/draw_way.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {

// Accept the current position of the temporary node and continue drawing.
drawWay.add = function(loc) {

// prevent duplicate nodes
var last = context.entity(way.nodes[way.nodes.length - (isArea ? 2 : 1)]);
if (last && last.loc[0] === loc[0] && last.loc[1] === loc[1]) return;

var newNode = iD.Node({loc: loc});

context.replace(
Expand Down

0 comments on commit a8f41b8

Please sign in to comment.