Add ctrl-z and make it work nicely with drawline

This commit is contained in:
Ansis Brammanis
2013-01-11 10:20:34 -05:00
parent 68a430cf70
commit 3fdf32f4dd
2 changed files with 13 additions and 7 deletions

View File

@@ -198,8 +198,8 @@ window.iD = function(container) {
controller.enter(iD.modes.AddLine());
})
.on('z', function(evt, mods) {
if (mods === '⇧⌘') history.redo();
if (mods === '⌘') history.undo();
if (mods === '⇧⌘' || mods === '⌃⇧') history.redo();
if (mods === '⌘' || mods === '⌃') history.undo();
});
var hash = iD.Hash().map(map);

View File

@@ -116,6 +116,11 @@ iD.modes.DrawLine = function(wayId, direction) {
controller.enter(iD.modes.Browse());
}
function undo() {
history.undo();
controller.enter(iD.modes.Browse());
}
surface
.on('mousemove.drawline', mousemove)
.on('click.drawline', click);
@@ -124,12 +129,13 @@ iD.modes.DrawLine = function(wayId, direction) {
.on('⎋.drawline', esc)
.on('⌫.drawline', backspace)
.on('⌦.drawline', del)
.on('↩.drawline', ret);
.on('↩.drawline', ret)
.on('z.drawline', function(evt, mods) {
if (mods === '⌘' || mods === '⌃') undo();
});
d3.select('#undo').on('click.drawline', undo);
d3.select('#undo').on('click.drawline', function() {
history.undo();
controller.enter(iD.modes.Browse());
});
};