From 285ea577cf746ce72a7e33257ce05ce3883fdadf Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 6 Nov 2012 17:09:53 -0500 Subject: [PATCH] Bind cmd-z, cmd-shift-z, a, r, and p --- index.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/index.html b/index.html index 6c40e5f16..de35df4d1 100755 --- a/index.html +++ b/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); + } + });