react / react-0.13.3 / examples / basic-commonjs / node_modules / reactify / node_modules / react-tools / src / browser / syntheticEvents / SyntheticWheelEvent.js
81155 views/**1* Copyright 2013-2014, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule SyntheticWheelEvent9* @typechecks static-only10*/1112"use strict";1314var SyntheticMouseEvent = require('SyntheticMouseEvent');1516/**17* @interface WheelEvent18* @see http://www.w3.org/TR/DOM-Level-3-Events/19*/20var WheelEventInterface = {21deltaX: function(event) {22return (23'deltaX' in event ? event.deltaX :24// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).25'wheelDeltaX' in event ? -event.wheelDeltaX : 026);27},28deltaY: function(event) {29return (30'deltaY' in event ? event.deltaY :31// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).32'wheelDeltaY' in event ? -event.wheelDeltaY :33// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).34'wheelDelta' in event ? -event.wheelDelta : 035);36},37deltaZ: null,3839// Browsers without "deltaMode" is reporting in raw wheel delta where one40// notch on the scroll is always +/- 120, roughly equivalent to pixels.41// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or42// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.43deltaMode: null44};4546/**47* @param {object} dispatchConfig Configuration used to dispatch this event.48* @param {string} dispatchMarker Marker identifying the event target.49* @param {object} nativeEvent Native browser event.50* @extends {SyntheticMouseEvent}51*/52function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {53SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);54}5556SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);5758module.exports = SyntheticWheelEvent;596061