Commit d5f9da6b by Zachary Tong

Add `keylistener` service

parent 260cf9ee
...@@ -106,4 +106,17 @@ angular.module('kibana.services', []) ...@@ -106,4 +106,17 @@ angular.module('kibana.services', [])
timers = new Array(); timers = new Array();
} }
}); })
.service('keylistener', function($rootScope) {
var keys = [];
$(document).keydown(function (e) {
console.log("keydown", e.which);
keys[e.which] = true;
});
$(document).keyup(function (e) {
console.log("keyup", e.which);
delete keys[e.which];
});
});
angular.module('kibana.map2', []) angular.module('kibana.map2', [])
.controller('map2', function ($scope, eventBus) { .controller('map2', function ($scope, eventBus, keylistener) {
// Set and populate defaults // Set and populate defaults
var _d = { var _d = {
...@@ -413,14 +413,16 @@ angular.module('kibana.map2', []) ...@@ -413,14 +413,16 @@ angular.module('kibana.map2', [])
//@todo implement a global "keypress service", since this fails if there are >1 spheres //@todo implement a global "keypress service", since this fails if there are >1 spheres
if (scope.panel.display.data.type === 'orthographic') { if (scope.panel.display.data.type === 'orthographic') {
window.focus(); //scope.svg.focus();
d3.select(window) /*
scope.svg.selectAll(".overlay")
.on("keydown", function() { .on("keydown", function() {
scope.ctrlKey = d3.event.ctrlKey; scope.ctrlKey = d3.event.ctrlKey;
}) })
.on("keyup", function() { .on("keyup", function() {
scope.ctrlKey = d3.event.ctrlKey; scope.ctrlKey = d3.event.ctrlKey;
}); });
*/
scope.svg.style("cursor", "move") scope.svg.style("cursor", "move")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment