Complete bindings for roads and areas. Fixes #180

This commit is contained in:
Tom MacWright
2012-12-12 17:22:45 -05:00
parent 4411a33a0c
commit f527a4f6fd
2 changed files with 43 additions and 8 deletions
+23 -4
View File
@@ -63,7 +63,7 @@ iD.modes.DrawArea = function(wayId) {
controller.enter(iD.modes.Browse());
}
function del() {
function backspace() {
d3.event.preventDefault();
history.replace(
@@ -80,10 +80,27 @@ iD.modes.DrawArea = function(wayId) {
}
}
function del() {
d3.event.preventDefault();
history.replace(iD.actions.DeleteWay(wayId));
controller.enter(iD.modes.Browse());
}
function ret() {
d3.event.preventDefault();
history.replace(
iD.actions.DeleteNode(node.id),
iD.actions.AddWayNode(way.id, tailId, -1),
'added to an area');
controller.enter(iD.modes.Browse());
}
map.surface.on('mousemove.drawarea', mousemove);
map.surface.on('click.drawarea', click);
map.keybinding().on('⎋.drawarea', esc);
map.keybinding().on('⌫.drawarea', del);
map.keybinding().on('⎋.drawarea', esc)
.on('⌫.drawarea', backspace)
.on('delete.drawarea', del)
.on('↩.drawarea', ret);
};
mode.exit = function() {
@@ -93,7 +110,9 @@ iD.modes.DrawArea = function(wayId) {
.on('mousemove.drawarea', null)
.on('click.drawarea', null);
mode.map.keybinding().on('⎋.drawarea', null)
.on('⌫.drawarea', null);
.on('⌫.drawarea', null)
.on('delete.drawarea', null)
.on('↩.drawarea', null);
window.setTimeout(function() {
mode.map.dblclickEnable(true);
}, 1000);
+20 -4
View File
@@ -81,7 +81,7 @@ iD.modes.DrawRoad = function(wayId, direction) {
controller.enter(iD.modes.Browse());
}
function del() {
function backspace() {
d3.event.preventDefault();
history.replace(
@@ -96,8 +96,22 @@ iD.modes.DrawRoad = function(wayId, direction) {
}
}
map.keybinding().on('⎋.drawroad', esc);
map.keybinding().on('⌫.drawroad', del);
function del() {
d3.event.preventDefault();
history.replace(iD.actions.DeleteWay(wayId));
controller.enter(iD.modes.Browse());
}
function ret() {
d3.event.preventDefault();
history.replace(iD.actions.DeleteNode(node.id));
controller.enter(iD.modes.Browse());
}
map.keybinding().on('⎋.drawroad', esc)
.on('⌫.drawroad', backspace)
.on('delete.drawroad', del)
.on('↩.drawroad', ret);
};
mode.exit = function() {
@@ -108,7 +122,9 @@ iD.modes.DrawRoad = function(wayId, direction) {
.on('mousemove.drawroad', null)
.on('click.drawroad', null);
mode.map.keybinding().on('⎋.drawroad', null)
.on('⌫.drawroad', null);
.on('⌫.drawroad', null)
.on('delete.drawroad', null)
.on('↩.drawroad', null);
window.setTimeout(function() {
mode.map.dblclickEnable(true);
}, 1000);