Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Horizontal scroll on trackpads #679

Open
pyronaur opened this issue Apr 13, 2014 · 3 comments
Open

Horizontal scroll on trackpads #679

pyronaur opened this issue Apr 13, 2014 · 3 comments

Comments

@pyronaur
Copy link

iScroll currently doesn't support horizontal scroll with trackpad horizontal swiping movement. The horizontal scroll is jumpy depending whether your horizontal movement is more downwards or upwards oriented.

Ticket #523 lead me to the right direction, but is still missing logic that determines whether iScroll should use the mouseWheelX or mouseWheelY. This fixes the issue for me as far as I've tested it for the last 5 minutes.

        wheelDeltaX *= this.options.invertWheelDirection;
        wheelDeltaY *= this.options.invertWheelDirection;

        // 2 lines above haven't been modified
        // I left them for reference where the code below is

        // Note:
        // This is line ± 1085 for me in iscroll-probe.js
        // I've made other modifications
        if ( !this.hasHorizontalScroll ) {
            wheelDeltaX = 0;
        } else if ( !this.hasVerticalScroll && this.options.mouseWheelScrollsHorizontally ) {

            // If absolute DeltaX is less than absolute DeltaX
            // Replace DeltaX with DeltaY
            // Otherwise just remove DeltaY and use the actual DeltaX 
            if( Math.abs(wheelDeltaX) < Math.abs(wheelDeltaY) ) {
                wheelDeltaX = wheelDeltaY;  
            }
            wheelDeltaY = 0;

        } if ( !this.hasVerticalScroll ) {
            wheelDeltaY = 0;
        }

As in #523, modify approx. line 247 and add this.options.mouseWheelScrollsHorizontally

    this.options = {

        resizeScrollbars: true,

        mouseWheelSpeed: 20,
        mouseWheelScrollsHorizontally: true,  // this line was added

I hope this helps someone, or maybe, gets merged in some day.

@marcj
Copy link

marcj commented Jul 23, 2016

Any news here?

ghost pushed a commit to e1-bsd/iscroll that referenced this issue Jan 16, 2017
@durchanek
Copy link

Thank you for posting this and +1 to merging!

@jackocnr
Copy link

jackocnr commented Mar 8, 2018

I need this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants