Skip to content

Instantly share code, notes, and snippets.

View andersfly's full-sized avatar

Anders Fly andersfly

View GitHub Profile
@andersfly
andersfly / detectDragModifierKeys.js
Created March 4, 2016 09:22
Detect modifier keys from underlying (or global) drag events
import pick from 'lodash/pick';
import bindAll from 'lodash/bindAll';
import React from 'react';
import ReactDOM from 'react-dom';
const MODIFIER_KEYS = ['ctrlKey', 'shiftKey', 'altKey', 'metaKey'];
/**
* Detects drag modifier keys on drag events that originated
* from the wrapped component