From 946ab2c09e3da8f5fa385c3ff53e55df53126691 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 29 Nov 2012 10:33:52 -0500 Subject: [PATCH] Properly remove popped node. Fixes #146 --- css/app.css | 5 +++++ js/id/actions/modes.js | 3 ++- js/id/renderer/map.js | 4 ++-- js/id/ui/commit.js | 8 +++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/css/app.css b/css/app.css index 72e9b0bbc..780d31f79 100644 --- a/css/app.css +++ b/css/app.css @@ -297,3 +297,8 @@ button small { width:630px; font-size:100%; } + +.commit-section { + max-height:250px; + overflow:scroll; +} diff --git a/js/id/actions/modes.js b/js/id/actions/modes.js index 3560dc435..f3c5581a0 100644 --- a/js/id/actions/modes.js +++ b/js/id/actions/modes.js @@ -193,7 +193,8 @@ iD.modes.DrawRoad = function(way_id) { node = iD.modes._node(this.map.projection.invert( d3.mouse(surface.node()))); } - way.nodes.pop(); + var old = this.map.history.graph().entity(way.nodes.pop()); + this.map.perform(iD.actions.removeWayNode(way, old)); way.nodes.push(node.id); this.map.perform(iD.actions.addWayNode(way, node)); way.nodes = way.nodes.slice(); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 8fe56b719..20f3050e0 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -378,8 +378,8 @@ iD.Map = function(elem, connection) { } function removeEntity(entity) { - var parents = map.history.graph().parents(entity.id); - parents + // Remove this node from any ways that is a member of + map.history.graph().parents(entity.id) .filter(function(d) { return d.type === 'way'; }) .forEach(function(parent) { parent.nodes = _.without(parent.nodes, entity.id); diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index b0d518bb3..db6ce3c9a 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -8,12 +8,12 @@ iD.commit = function() { header.append('h2').text('Save Changes to OpenStreetMap'); - var section = body.selectAll('div.section') + var section = body.selectAll('div.commit-section') .data(['modify', 'delete', 'create'].filter(function(d) { return changes[d].length; })) .enter() - .append('div').attr('class', 'section'); + .append('div').attr('class', 'commit-section'); section.append('h3').text(String) .append('small') @@ -26,9 +26,7 @@ iD.commit = function() { .enter() .append('li'); - li.append('strong').text(function(d) { - return d.type + ' '; - }); + li.append('strong').text(function(d) { return d.type + ' '; }); li.append('span') .text(function(d) { return iD.Util.friendlyName(d);