From c5dbebc063226df751924942c65db6d67e40dbec Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sat, 8 Dec 2012 16:04:03 -0800 Subject: [PATCH] Move keybinding to map --- js/id/id.js | 4 +--- js/id/renderer/map.js | 4 +++- test/index.html | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/id/id.js b/js/id/id.js index 296a2bdae..8a65570e4 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -191,7 +191,7 @@ window.iD = function(container) { map.size(m.size()); }; - var keybinding = d3.keybinding() + map.keybinding() .on('a', function(evt, mods) { controller.enter(iD.modes.AddArea()); }) @@ -205,8 +205,6 @@ window.iD = function(container) { if (mods === 'โ‡งโŒ˜') history.redo(); if (mods === 'โŒ˜') history.undo(); }); - d3.select(document).call(keybinding); - map.keybinding(keybinding); var hash = iD.Hash().map(map); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index e74d3e61c..fd5caf5d3 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -4,7 +4,7 @@ iD.Map = function() { dispatch = d3.dispatch('move'), selection = null, hover = null, translateStart, - keybinding, + keybinding = d3.keybinding(), projection = d3.geo.mercator().scale(1024), zoom = d3.behavior.zoom() .translate(projection.translate()) @@ -63,6 +63,8 @@ iD.Map = function() { map.size(this.size()); map.surface = surface; + + d3.select(document).call(keybinding); } function pxCenter() { return [dimensions[0] / 2, dimensions[1] / 2]; } diff --git a/test/index.html b/test/index.html index 7e5abcda2..5db9e7245 100644 --- a/test/index.html +++ b/test/index.html @@ -20,6 +20,7 @@ +