Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two finger scrolling on touch devices #70

Closed
JonFabritius opened this issue Feb 13, 2020 · 2 comments
Closed

Two finger scrolling on touch devices #70

JonFabritius opened this issue Feb 13, 2020 · 2 comments
Labels
feature request New feature requested

Comments

@JonFabritius
Copy link

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

Two finger scrolling on touch devices is missing, and two finger touches result in selection of elements. Figuring out the implementation is almost, but not quite in my grasp ;)

If the current behavior is a bug, please provide the steps to reproduce and create a JSFiddle.

What is the expected behavior?

Two fingered scrolling on touch devices should retain the current selection and allow scrolling the content area without selecting elements; essentially just pausing the selecting logic during .move() and letting the OS native two finger scroll work as usual.

Your environment:

Selection-version: 1.5.0 (CDN)
Browser-version:  Safari (iPadOS 13)
Operating-system:  iPadOS 13
@simonwep simonwep added the feature request New feature requested label Feb 14, 2020
@simonwep
Copy link
Owner

I've added a trigger method which can be used to achieve that kind of functionality, in your case it'd be:

// Intercept start of selection
selection.on('beforestart', (() => {
    let timeout = null;

    return ({oe}) => {

        // Check if user already tapped inside of a selection-area.
        if (timeout !== null) {

            // A second pointer-event occured, ignore that one.
            clearTimeout(timeout);
            timeout = null;
        } else {

            // Wait 50ms in case the user uses two fingers to scroll.
            timeout = setTimeout(() => {

                // OK User used only one finger, we can safely initiate a selection and reset the timer.
                selection.trigger(oe);
                timeout = null;
            }, 50);
        }

        // Never start automatically.
        return false;
    };
})());

Added in a10c61f, I'll publish a new release in a few days :)

@simonwep
Copy link
Owner

simonwep commented Mar 6, 2020

I've created a examples.md file were future requests like this can be demonstrated :)

@simonwep simonwep closed this as completed Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature requested
Projects
None yet
Development

No branches or pull requests

2 participants