-
Notifications
You must be signed in to change notification settings - Fork 120
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
feat(mobile): add touch delay to allow scroll on mobile #315
Conversation
…mobile, while image with drift zoom covers the screen.
Hm - the tests wont run on windows - so i cant test it locally. Anyway it ist strange - because the touchDelay parameter is passed and should be present.
|
…mobile, while image with drift zoom covers the screen.
…mobile, while image with drift zoom covers the screen.
…mobile, while image with drift zoom covers the screen.
…mobile, while image with drift zoom covers the screen.
PrettierCI master Sync
…mobile, while image with drift zoom covers the screen.
Hey, thanks for the PR @begner! |
Sure Visit with your mobile and try to scroll down. Thats the issue: Thats with the fix: Note: For IOS i suggest to add: imageElement.addEventListener('touchforcechange', function (event) {
if (event.changedTouches[0].force > 0.1) {
event.preventDefault()
return false
}
}) to prevent ios-specific pop up images on "hard" press (force-touch, 3d touch - or whatever their marketing name is for that) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome @begner! The solution works really well.
Only one small thing, can you please uncommit the dist/
files? We generally build everything at the end when we release a new version of the library. Thanks
This reverts commit c491e34
Done - was a mistake, should have been in a branch. :D |
@begner no problem and thanks! |
As long as the used headless-test-browsers does not support REAL mobile behaviours (with real touchevents): no. |
Fair enough, besides that I think this PR is good to go. Thanks for putting in the time to address my feedback @begner |
@sherwinski Can you drop me a note, when the npm version is released? |
@begner |
Great news @begner, this feature is now released as part of Drift v1.4.0 🎉 |
👍 |
Description
This is a fix for touch capable devices, there drift zoom prevents scrolling while displayed on screen. The Drift Stage cant be use for start oft gestures, because the event will always be
default-prevented. Its not breaking because you need to set touchDelay (> 0) for this to work. IF there is touchdelay set, drift only prevents browsers default behaviour if the zoom is active. otherwise the events will pass. Fixes #77
Bug Fix
Steps to Test:
You cant!
With fix:
set touchDelay to 500
try to scroll down (while gesture starts on the image)
You can scroll now!
holding you finger on the image on the image for > 500ms
now you can move around the zoom maginfication bubble without scrolling