From a8f41b8c575062456ba017f830a352c171926b05 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 5 Apr 2013 16:35:51 -0400 Subject: [PATCH] Prevent creation of ways with duplicate nodes Related to #1249 --- js/id/behavior/draw_way.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 731260dbb..3b9e3d322 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -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(