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

doubleTapThreshold prop breaks touch events on SVG. #5

Open
rrrhys opened this issue May 11, 2018 · 4 comments
Open

doubleTapThreshold prop breaks touch events on SVG. #5

rrrhys opened this issue May 11, 2018 · 4 comments

Comments

@rrrhys
Copy link

rrrhys commented May 11, 2018

When the doubleTapThreshold prop is set, touch events never get passed through to the underlying SVG.

shouldRespond returns a truthy value when doubleTapThreshold is set, causing the view to always set the pan responder.

        !lock &&
        (evt.nativeEvent.touches.length === 2 ||
          dx * dx + dy * dy >= moveThreshold ||
          doubleTapThreshold)

In my case I removed doubleTapThreshold from ZoomableSvg props.

If this is by design, could you add to the homepage docs?

Thanks for your great work @msand, saved me many hours!

@msand
Copy link
Owner

msand commented May 25, 2018

Oh, I see. Hadn't thought about this interaction. Should probably document it, or figure out a better solution. I guess you're not in need of the double tap function. I'll look around a bit for how or if this has been solved in other contexts to allow both double tap to zoom and interact with ancestors, I guess it might be enough to move the check for double taps into shouldRespond, just feels like the wrong place to add side-effects.

@BabakSamimi
Copy link

Is the double tap zoom a thing or how would I implement it?

@msand
Copy link
Owner

msand commented Mar 22, 2019

Well, if you only need double tap zoom, it should be enough to give a non-zero value to doubleTapThreshold, and if you want events to go to the underlying svg content you need to set it to zero. Otherwise, the shouldRespond logic needs to be adapted to the needs.

@nksazonov
Copy link

Oh, I see. Hadn't thought about this interaction. Should probably document it, or figure out a better solution. I guess you're not in need of the double tap function. I'll look around a bit for how or if this has been solved in other contexts to allow both double tap to zoom and interact with ancestors, I guess it might be enough to move the check for double taps into shouldRespond, just feels like the wrong place to add side-effects.

@msand, could you describe how to move the check for the double taps into shouldRespond or other methods to make children elements recieve touches while doubleTapThreshold is set?

Your help would be very appreciated!

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

No branches or pull requests

4 participants