mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-26 07:23:40 +00:00
Fix way finishing, start on split way
This commit is contained in:
@@ -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>
|
||||
|
||||
7
js/id/actions/split_way.js
Normal file
7
js/id/actions/split_way.js
Normal 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');
|
||||
};
|
||||
};
|
||||
@@ -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(
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user