* Gets wheel event values.
* @returns wheel event values
function getWheelEventValues(event, transform) {
if (transform === void 0) {
var deltaX = event.deltaX,
deltaMode = event.deltaMode; // normalize wheel values, especially for Firefox
} else if (deltaMode === 2) {
return transform([deltaX, deltaY]);
* Gets webkit gesture event values.
* @returns webkit gesture event values
function getWebkitGestureEventValues(event, transform) {
if (transform === void 0) {
return transform([event.scale, event.rotation]);
var DEFAULT_DRAG_DELAY = 180;
var DEFAULT_RUBBERBAND = 0.15;
var DEFAULT_SWIPE_VELOCITY = 0.5;
var DEFAULT_SWIPE_DISTANCE = 50;
var DEFAULT_SWIPE_DURATION = 250;
var InternalGestureOptionsNormalizers = {
threshold: function threshold(value) {
return ensureVector(value);
rubberband: function rubberband(value) {
return ensureVector(DEFAULT_RUBBERBAND);
return ensureVector(value);
enabled: function enabled(value) {
triggerAllEvents: function triggerAllEvents(value) {
initial: function initial(value) {
if (typeof value === 'function') return value;
return ensureVector(value);
var InternalCoordinatesOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
lockDirection: function lockDirection(value) {
bounds: function bounds(value) {
if (typeof value === 'function') return function (state) {
return InternalCoordinatesOptionsNormalizers.bounds(value(state));
_value2$left = _value2.left,
left = _value2$left === void 0 ? -Infinity : _value2$left,
_value2$right = _value2.right,
right = _value2$right === void 0 ? Infinity : _value2$right,
_value2$top = _value2.top,
top = _value2$top === void 0 ? -Infinity : _value2$top,
_value2$bottom = _value2.bottom,
bottom = _value2$bottom === void 0 ? Infinity : _value2$bottom;
return [[left, right], [top, bottom]];
var isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
var InternalGenericOptionsNormalizers = {
enabled: function enabled(value) {
window: /*#__PURE__*/function (_window) {
return _window.apply(this, arguments);
window.toString = function () {
return _window.toString();
value = isBrowser ? window : undefined;
eventOptions: function eventOptions(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$passive = _ref.passive,
passive = _ref$passive === void 0 ? true : _ref$passive,
_ref$capture = _ref.capture,
capture = _ref$capture === void 0 ? false : _ref$capture;
var InternalDistanceAngleOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
bounds: function bounds(_value, _key, _ref2) {
var _ref2$distanceBounds = _ref2.distanceBounds,
distanceBounds = _ref2$distanceBounds === void 0 ? {} : _ref2$distanceBounds,
_ref2$angleBounds = _ref2.angleBounds,
angleBounds = _ref2$angleBounds === void 0 ? {} : _ref2$angleBounds;
var _distanceBounds = function _distanceBounds(state) {
var D = assignDefault(valueFn(distanceBounds, state), {
var _angleBounds = function _angleBounds(state) {
var A = assignDefault(valueFn(angleBounds, state), {
if (typeof distanceBounds !== 'function' && typeof angleBounds !== 'function') return [_distanceBounds(), _angleBounds()];
return function (state) {
return [_distanceBounds(state), _angleBounds(state)];
var InternalDragOptionsNormalizers = /*#__PURE__*/_extends({}, InternalCoordinatesOptionsNormalizers, {
useTouch: function useTouch(value) {
var supportsTouch = supportsTouchEvents();
var supportsPointer = supportsPointerEvents();
if (value && supportsTouch) return true;
if (supportsTouch && !supportsPointer) return true;
experimental_preventWindowScrollY: function experimental_preventWindowScrollY(value) {
threshold: function threshold(v, _k, _ref3) {
var _ref3$filterTaps = _ref3.filterTaps,
filterTaps = _ref3$filterTaps === void 0 ? false : _ref3$filterTaps,
_ref3$lockDirection = _ref3.lockDirection,
lockDirection = _ref3$lockDirection === void 0 ? false : _ref3$lockDirection,
axis = _ref3$axis === void 0 ? undefined : _ref3$axis;
var A = ensureVector(v, filterTaps ? 3 : lockDirection ? 1 : axis ? 1 : 0);
this.filterTaps = filterTaps;
swipeVelocity: function swipeVelocity(v) {
v = DEFAULT_SWIPE_VELOCITY;
swipeDistance: function swipeDistance(v) {
v = DEFAULT_SWIPE_DISTANCE;
swipeDuration: function swipeDuration(value) {
value = DEFAULT_SWIPE_DURATION;
delay: function delay(value) {
return DEFAULT_DRAG_DELAY;
function getInternalGenericOptions(config) {
// TODO warn when passive is set to true and domTarget is undefined
return resolveWith(config, InternalGenericOptionsNormalizers);
function getInternalCoordinatesOptions(config) {
return resolveWith(config, InternalCoordinatesOptionsNormalizers);
function getInternalDistanceAngleOptions(config) {
return resolveWith(config, InternalDistanceAngleOptionsNormalizers);
function getInternalDragOptions(config) {
return resolveWith(config, InternalDragOptionsNormalizers);
function _buildMoveConfig(_ref) {
var domTarget = _ref.domTarget,
eventOptions = _ref.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
opts.move = getInternalCoordinatesOptions(rest);
function _buildHoverConfig(_ref2) {
var domTarget = _ref2.domTarget,
eventOptions = _ref2.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref2, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
function _buildDragConfig(_ref3) {
var domTarget = _ref3.domTarget,
eventOptions = _ref3.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref3, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
opts.drag = getInternalDragOptions(rest);
function _buildPinchConfig(_ref4) {
var domTarget = _ref4.domTarget,
eventOptions = _ref4.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref4, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
opts.pinch = getInternalDistanceAngleOptions(rest);
function _buildScrollConfig(_ref5) {
var domTarget = _ref5.domTarget,
eventOptions = _ref5.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref5, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
opts.scroll = getInternalCoordinatesOptions(rest);
function _buildWheelConfig(_ref6) {
var domTarget = _ref6.domTarget,
eventOptions = _ref6.eventOptions,
rest = _objectWithoutPropertiesLoose(_ref6, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
eventOptions: eventOptions,
opts.wheel = getInternalCoordinatesOptions(rest);
function buildComplexConfig(config, actions) {
if (actions === void 0) {
eventOptions = _config.eventOptions,
transform = _config.transform,
domTarget = _config.domTarget,
enabled = _config.enabled;
var mergedConfig = getInternalGenericOptions({
eventOptions: eventOptions,
if (actions.has('onDrag')) mergedConfig.drag = getInternalDragOptions(drag);
if (actions.has('onWheel')) mergedConfig.wheel = getInternalCoordinatesOptions(wheel);
if (actions.has('onScroll')) mergedConfig.scroll = getInternalCoordinatesOptions(scroll);
if (actions.has('onMove')) mergedConfig.move = getInternalCoordinatesOptions(move);
if (actions.has('onPinch')) mergedConfig.pinch = getInternalDistanceAngleOptions(pinch);
if (actions.has('onHover')) mergedConfig.hover = _extends({
function getInitial(mixed) {
_intentional: [false, false],
_bounds: [[-Infinity, Infinity], [-Infinity, Infinity]],
_lastEventType: undefined,
_dragPreventScroll: false,
function getInitialState() {