mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 19:26:41 +02:00
Fix Disconnect of way with multiple intersections (fixes #1955)
This commit is contained in:
@@ -22,7 +22,7 @@ iD.actions.Disconnect = function(nodeId, newNodeId) {
|
||||
replacements.forEach(function(replacement) {
|
||||
var newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
|
||||
graph = graph.replace(newNode);
|
||||
graph = graph.replace(replacement.way.updateNode(newNode.id, replacement.index));
|
||||
graph = graph.replace(graph.entity(replacement.wayID).updateNode(newNode.id, replacement.index));
|
||||
});
|
||||
|
||||
return graph;
|
||||
@@ -41,7 +41,7 @@ iD.actions.Disconnect = function(nodeId, newNodeId) {
|
||||
|
||||
parent.nodes.forEach(function(waynode, index) {
|
||||
if (waynode === nodeId) {
|
||||
candidates.push({way: parent, index: index});
|
||||
candidates.push({wayID: parent.id, index: index});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -128,6 +128,30 @@ describe("iD.actions.Disconnect", function () {
|
||||
expect(graph.entity('w').nodes).to.eql(['a', 'b', 'c', 'd']);
|
||||
});
|
||||
|
||||
it("disconnects a way with multiple intersection points", function() {
|
||||
// Situtation:
|
||||
// a = b - c
|
||||
// | |
|
||||
// e - d
|
||||
// Where b starts/ends -.
|
||||
// Disconnect at b
|
||||
|
||||
var graph = iD.Graph([
|
||||
iD.Node({id: 'a'}),
|
||||
iD.Node({id: 'b'}),
|
||||
iD.Node({id: 'c'}),
|
||||
iD.Node({id: 'd'}),
|
||||
iD.Node({id: 'e'}),
|
||||
iD.Way({id: 'w1', nodes: ['a', 'b']}),
|
||||
iD.Way({id: 'w2', nodes: ['b', 'c', 'd', 'e', 'b']})
|
||||
]);
|
||||
|
||||
graph = iD.actions.Disconnect('b', '*')(graph);
|
||||
|
||||
expect(graph.entity('w1').nodes).to.eql(['a', 'b']);
|
||||
expect(graph.entity('w2').nodes).to.eql(['*', 'c', 'd', 'e', '*']);
|
||||
});
|
||||
|
||||
it("copies location and tags to the new nodes", function () {
|
||||
var tags = {highway: 'traffic_signals'},
|
||||
loc = [1, 2],
|
||||
|
||||
Reference in New Issue
Block a user