Fix way finishing, start on split way

This commit is contained in:
Tom MacWright
2012-12-07 10:42:16 -05:00
parent 23856cc1c5
commit f49728872e
4 changed files with 24 additions and 3 deletions

View File

@@ -55,6 +55,7 @@
<script src='js/id/actions/remove_relation_member.js'></script>
<script src='js/id/actions/remove_way_node.js'></script>
<script src='js/id/actions/reverse_way.js'></script>
<script src='js/id/actions/split_way.js'></script>
<script src='js/id/modes.js'></script>
<script src='js/id/modes/drag_features.js'></script>

View File

@@ -0,0 +1,7 @@
// https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/SplitWayAction.as
iD.actions.SplitWay = function(nodeId, wayId) {
return function(graph) {
var way = graph.entity(wayId);
return graph.replace(way.update({nodes: nodes}), 'changed way direction');
};
};

View File

@@ -38,6 +38,12 @@ iD.modes.DrawRoad = function(wayId, direction) {
controller.enter(iD.modes.Select(way));
} else if (datum.id === headId) {
// finish the way
history.replace(iD.actions.DeleteNode(node.id));
controller.enter(iD.modes.Select(way));
} else if (datum.type === 'node' && datum.id !== node.id) {
// connect the way to an existing node
history.replace(

View File

@@ -32,9 +32,16 @@ iD.Inspector = function() {
.attr('href', '#')
.text('Reverse Direction')
.on('click', function(d) {
event.changeWayDirection(iD.Entity(d, {
nodes: _.pluck(d.nodes.reverse(), 'id')
}));
event.changeWayDirection(iD.Entity(d));
});
}
if (selection.datum().type === 'node' && !selection.datum()._poi) {
selection.append('a')
.attr('class', 'permalink')
.attr('href', '#')
.text('Split Way')
.on('click', function(d) {
event.splitWay(iD.Entity(d));
});
}
}