add an observeElement option to Handler.Keyboard and Control.KeyboardDefaults to control the DOM element on which key events are observed
This commit is contained in:
@@ -34,6 +34,15 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
slideFactor: 75,
|
||||
|
||||
/**
|
||||
* APIProperty: observeElement
|
||||
* {DOMelement|String} The DOM element to handle keys for. You
|
||||
* can use the map div here, to have the navigation keys
|
||||
* work when the map div has the focus. If undefined the
|
||||
* document is used.
|
||||
*/
|
||||
observeElement: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.KeyboardDefaults
|
||||
*/
|
||||
@@ -43,8 +52,11 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Create handler.
|
||||
*/
|
||||
draw: function() {
|
||||
this.handler = new OpenLayers.Handler.Keyboard( this, {
|
||||
"keydown": this.defaultKeyPress });
|
||||
var observeElement = this.observeElement || document;
|
||||
this.handler = new OpenLayers.Handler.Keyboard( this,
|
||||
{"keydown": this.defaultKeyPress},
|
||||
{observeElement: observeElement}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user