mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 09:42:56 +00:00
Add ctrl-z and make it work nicely with drawline
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user