MCPcopy
hub / github.com/autoNumeric/autoNumeric / wheelAction

Method wheelAction

src/AutoNumeric.js:7711–7733  ·  view source on GitHub ↗

* Increment or decrement the element value according to the `wheelStep` option chosen * * @param {WheelEvent} e The `wheel` event

(e)

Source from the content-addressed store, hash-verified

7709 * @param {WheelEvent} e The `wheel` event
7710 */
7711 wheelAction(e) {
7712 this.isWheelEvent = true; // Keep the info that we are currently managing a mouse wheel event
7713
7714 let isUp = false;
7715 let isDown = false;
7716 let isDeltaYZero = false;
7717 if (AutoNumericHelper.isWheelUpEvent(e)) {
7718 isUp = true;
7719 } else if (AutoNumericHelper.isWheelDownEvent(e)) {
7720 isDown = true;
7721 } else if (AutoNumericHelper.isWheelEventWithZeroDeltaY(e)) {
7722 // Ignore that event (maybe call e.preventDefault() ?), fixes issue #776
7723 isDeltaYZero = true;
7724 } else {
7725 AutoNumericHelper.throwError(`The event is not a 'wheel' event.`);
7726 }
7727
7728 if (!isDeltaYZero) {
7729 this._wheelAndUpDownActions(e, isUp, isDown, this.settings.wheelStep);
7730 }
7731
7732 this.isWheelEvent = false; // Set back the mouse wheel indicator to its default
7733 }
7734
7735 /**
7736 * Handler for 'drop' event

Callers 1

_onWheelMethod · 0.95

Calls 5

isWheelUpEventMethod · 0.80
isWheelDownEventMethod · 0.80
throwErrorMethod · 0.80

Tested by

no test coverage detected