Properly remove popped node. Fixes #146

This commit is contained in:
Tom MacWright
2012-11-29 10:33:52 -05:00
parent a202202e9f
commit 946ab2c09e
4 changed files with 12 additions and 8 deletions
+5
View File
@@ -297,3 +297,8 @@ button small {
width:630px;
font-size:100%;
}
.commit-section {
max-height:250px;
overflow:scroll;
}
+2 -1
View File
@@ -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();
+2 -2
View File
@@ -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);
+3 -5
View File
@@ -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);