Gubancs / leaflet4vaadin

:herb: Leaflet4Vaadin :herb: provides a Java API for Leaflet, which is a popular map implementation, similar to Google Maps. Leaflet is lightweight and shines on mobile devices. Also it has an extensive set of add-ons, of which many are available for Vaadin too.
https://leaflet4vaadin.herokuapp.com/
Other
25 stars 19 forks source link

tap does not work on smart phones #8

Open Gubancs opened 4 years ago

Gubancs commented 4 years ago

It seems to me that the tap does not work on smart phones also if I add setTap(true) on MapOptions, for example:

MapOptions options = new DefaultMapOptions(); options.setTap(true); LeafletMap leafletMap = new LeafletMap(options); leafletMap.setBaseUrl("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"); leafletMap.onClick((e) -> { Notification.show("New marker added to map.", 3000, Position.TOP_CENTER); });

Environment

Leaflet version: 1.6.0 Browser (with version): Safari OS/Platform (with version): iOS 13.3.1

Gubancs commented 4 years ago

it seems to a 'mousedown' event fired on iPhone 8 instead of 'click' event. You can use temporarily the onMouseDown(...) event handler as a workaround. I'm not sure why the map does not fire the click event, maybe a leaflet issue. By the way, in the leaflet GitHub repository, there is a project in connection with refactoring the touch events https://github.com/Leaflet/Leaflet/projects/1

Relating to the leaflet documentation the "tap" is enabled by default so you don't have to enable it.

Gubancs commented 4 years ago

Releated issue -> https://github.com/Leaflet/Leaflet/issues/6705