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

Horizontal scroll on trackpads #679

Open
@pyronaur

Description

@pyronaur

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions