mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Bind cmd-z, cmd-shift-z, a, r, and p
This commit is contained in:
24
index.html
24
index.html
@@ -109,6 +109,30 @@
|
||||
|
||||
d3.select('#undo').on('click', map.undo);
|
||||
d3.select('#redo').on('click', map.redo);
|
||||
|
||||
d3.select(document).on('keydown', function() {
|
||||
console.log(d3.event);
|
||||
// cmd-z
|
||||
if (d3.event.which === 90 && d3.event.metaKey) {
|
||||
map.undo();
|
||||
}
|
||||
// cmd-shift-z
|
||||
if (d3.event.which === 90 && d3.event.metaKey && d3.event.shiftKey) {
|
||||
map.redo();
|
||||
}
|
||||
// p
|
||||
if (d3.event.which === 80) {
|
||||
controller.go(iD.actions.AddPlace);
|
||||
}
|
||||
// r
|
||||
if (d3.event.which === 82) {
|
||||
controller.go(iD.actions.AddRoad);
|
||||
}
|
||||
// a
|
||||
if (d3.event.which === 65) {
|
||||
controller.go(iD.actions.AddArea);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user