-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Touch event default behaviours disabled in control preventing scrolling #3253
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
Comments
I found a nice solution by looking at the hierarchy of event propagation. OL handles the touchmove event as last handler. So I catch touchstart,touchmove,touchend for my control and call stopPropagation to prevent the event from going through to OL. Scrolling works now nicely. |
Nice that you found a work-around! I am not 100% sure anymore why this I think you could also show the list not as an ol control, but simply as a container with position absolute and a high z-index. By doing that you should get the event before the listener on the map. |
I had the same problem. |
I added a custom control to a map containing a scrollable list. This list is not scrollable on touch platforms (but works normal on desktop/mouse interaction).
Reason: ol.pointer.TouchSource.prototype.touchmove calls preventDefault on the event, therefore disabling normal touch scrolling behaviour on the target control. Comment out the preventDefault call and everything works.
Why is preventDefault called? If it is really needed, how could I cleanly implement touch scrolling?
The text was updated successfully, but these errors were encountered: