Adding support support for metaKey (Mac Cmd key)

This commit is contained in:
Pierre GIRAUD
2012-05-21 11:13:48 +02:00
parent 348dffcda6
commit a997334816
2 changed files with 21 additions and 10 deletions

View File

@@ -139,7 +139,8 @@ OpenLayers.Handler = OpenLayers.Class({
var keyModifiers =
(evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
(evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |
(evt.altKey ? OpenLayers.Handler.MOD_ALT : 0);
(evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |
(evt.metaKey ? OpenLayers.Handler.MOD_META : 0);
/* if it differs from the handler object's key mask,
bail out of the event handler */
@@ -232,12 +233,12 @@ OpenLayers.Handler = OpenLayers.Class({
* to get more information about the event that the handler is
* processing.
*
* This allows modifier keys on the event to be checked (alt, shift,
* and ctrl cannot be checked with the keyboard handler). For a
* This allows modifier keys on the event to be checked (alt, shift, ctrl,
* and meta cannot be checked with the keyboard handler). For a
* control to determine which modifier keys are associated with the
* event that a handler is currently processing, it should access
* (code)handler.evt.altKey || handler.evt.shiftKey ||
* handler.evt.ctrlKey(end).
* handler.evt.ctrlKey || handler.evt.metaKey(end).
*
* Parameters:
* evt - {Event} The browser event.
@@ -285,4 +286,10 @@ OpenLayers.Handler.MOD_CTRL = 2;
*/
OpenLayers.Handler.MOD_ALT = 4;
/**
* Constant: OpenLayers.Handler.MOD_META
* If set as the <keyMask>, <checkModifiers> returns false if Cmd is down.
*/
OpenLayers.Handler.MOD_META = 8;