Skip to content

Commit

Permalink
Merge pull request mapbox#315 from lukeelmers/master
Browse files Browse the repository at this point in the history
Ensure keybindings option is enforced
  • Loading branch information
mcwhittemore committed May 31, 2016
2 parents bddf077 + 90e7afa commit 310394f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,21 @@ module.exports = function(ctx) {
ctx.map.on('mousedown', events.mousedown);
ctx.map.on('mouseup', events.mouseup);

ctx.container.addEventListener('keydown', events.keydown);
ctx.container.addEventListener('keyup', events.keyup);
if (ctx.options.keybindings) {
ctx.container.addEventListener('keydown', events.keydown);
ctx.container.addEventListener('keyup', events.keyup);
}
},
removeEventListeners: function() {
ctx.map.off('mousemove', events.mousemove);

ctx.map.off('mousedown', events.mousedown);
ctx.map.off('mouseup', events.mouseup);

ctx.container.removeEventListener('keydown', events.keydown);
ctx.container.removeEventListener('keyup', events.keyup);
if (ctx.options.keybindings) {
ctx.container.removeEventListener('keydown', events.keydown);
ctx.container.removeEventListener('keyup', events.keyup);
}
}
};

Expand Down

0 comments on commit 310394f

Please sign in to comment.