mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02:00
Clean elastic flag on all mode exit paths (fixes #194)
This commit is contained in:
@@ -13,6 +13,13 @@ iD.modes.DrawArea = function(way_id) {
|
||||
firstnode_id = _.first(way.nodes),
|
||||
node = iD.Node({loc: mode.map.mouseCoordinates()});
|
||||
|
||||
function finish(next) {
|
||||
way = mode.history.graph().entity(way.id);
|
||||
way.tags = _.omit(way.tags, 'elastic');
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(way, way.tags));
|
||||
return mode.controller.enter(next);
|
||||
}
|
||||
|
||||
mode.history.perform(iD.actions.AddWayNode(way, node));
|
||||
|
||||
mode.map.surface.on('mousemove.drawarea', function() {
|
||||
@@ -29,12 +36,8 @@ iD.modes.DrawArea = function(way_id) {
|
||||
mode.history.replace(iD.actions.DeleteNode(node));
|
||||
mode.history.replace(iD.actions.AddWayNode(way,
|
||||
mode.history.graph().entity(way.nodes[0])));
|
||||
way = mode.history.graph().entity(way.id);
|
||||
way.tags = _.omit(way.tags, 'elastic');
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(way, way.tags));
|
||||
|
||||
// End by clicking on own tail
|
||||
return mode.controller.enter(iD.modes.Select(way));
|
||||
return finish(iD.modes.Select(way));
|
||||
} else {
|
||||
// connect a way to an existing way
|
||||
mode.history.replace(iD.actions.AddWayNode(way, datum));
|
||||
@@ -48,9 +51,10 @@ iD.modes.DrawArea = function(way_id) {
|
||||
});
|
||||
|
||||
mode.map.keybinding().on('⎋.drawarea', function() {
|
||||
mode.controller.exit();
|
||||
})
|
||||
.on('⌫.drawarea', function() {
|
||||
finish(iD.modes.Browse());
|
||||
});
|
||||
|
||||
mode.map.keybinding().on('⌫.drawarea', function() {
|
||||
d3.event.preventDefault();
|
||||
var lastNode = _.last(way.nodes);
|
||||
mode.history.replace(iD.actions.removeWayNode(way,
|
||||
|
||||
@@ -16,6 +16,12 @@ iD.modes.DrawRoad = function(way_id, direction) {
|
||||
firstNode = way.nodes[0],
|
||||
lastNode = _.last(way.nodes);
|
||||
|
||||
function finish(next) {
|
||||
way.tags = _.omit(way.tags, 'elastic');
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(way, way.tags));
|
||||
return mode.controller.enter(next);
|
||||
}
|
||||
|
||||
mode.history.perform(iD.actions.AddWayNode(way, node, index));
|
||||
|
||||
mode.map.surface.on('mousemove.drawroad', function() {
|
||||
@@ -40,12 +46,7 @@ iD.modes.DrawRoad = function(way_id, direction) {
|
||||
mode.history.graph().entity(lastNode), index));
|
||||
}
|
||||
|
||||
way.tags = _.omit(way.tags, 'elastic');
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(
|
||||
way, way.tags));
|
||||
|
||||
// End by clicking on own tail
|
||||
return mode.controller.enter(iD.modes.Select(way));
|
||||
return finish(iD.modes.Select(way));
|
||||
} else {
|
||||
// connect a way to an existing way
|
||||
mode.history.replace(iD.actions.AddWayNode(way, datum, index));
|
||||
@@ -70,7 +71,7 @@ iD.modes.DrawRoad = function(way_id, direction) {
|
||||
});
|
||||
|
||||
mode.map.keybinding().on('⎋.drawroad', function() {
|
||||
mode.controller.exit();
|
||||
finish(iD.modes.Browse());
|
||||
});
|
||||
|
||||
mode.map.keybinding().on('⌫.drawroad', function() {
|
||||
|
||||
Reference in New Issue
Block a user