mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
45
react-app/node_modules/react/lib/getEventModifierState.js
generated
vendored
Normal file
45
react-app/node_modules/react/lib/getEventModifierState.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule getEventModifierState
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Translation from modifier key to the associated property in the event.
|
||||
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
||||
*/
|
||||
|
||||
var modifierKeyToProp = {
|
||||
'Alt': 'altKey',
|
||||
'Control': 'ctrlKey',
|
||||
'Meta': 'metaKey',
|
||||
'Shift': 'shiftKey'
|
||||
};
|
||||
|
||||
// IE8 does not implement getModifierState so we simply map it to the only
|
||||
// modifier keys exposed by the event itself, does not support Lock-keys.
|
||||
// Currently, all major browsers except Chrome seems to support Lock-keys.
|
||||
function modifierStateGetter(keyArg) {
|
||||
/*jshint validthis:true */
|
||||
var syntheticEvent = this;
|
||||
var nativeEvent = syntheticEvent.nativeEvent;
|
||||
if (nativeEvent.getModifierState) {
|
||||
return nativeEvent.getModifierState(keyArg);
|
||||
}
|
||||
var keyProp = modifierKeyToProp[keyArg];
|
||||
return keyProp ? !!nativeEvent[keyProp] : false;
|
||||
}
|
||||
|
||||
function getEventModifierState(nativeEvent) {
|
||||
return modifierStateGetter;
|
||||
}
|
||||
|
||||
module.exports = getEventModifierState;
|
Reference in New Issue
Block a user