How to set up touch interaction on booklet maps

How to set up booklet maps to disable one-finger scrolling on mobile devices and add two finger scrolling, such as Google maps (see https://developers.google.com/maps/documentation/javascript/interaction )

I think that something like a listener is thumbs down and thumbs up and a user invoice or sth. how it should help. But how to integrate this correctly as a plugin in a leaflet?

<html> <head> <link href="https://unpkg.com/ leaflet@1.0.2 /dist/leaflet.css" rel="stylesheet"/> <script src="https://unpkg.com/ leaflet@1.0.2 /dist/leaflet.js"></script> </head> <body> <div id="mapid" style="width: 600px; height: 400px;"></div> <script> var mymap = L.map('mapid', {center: [48,9], zoom:8, layers: [L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')]}); </script> </body> </html> 
+7
maps touch leaflet interaction
source share
1 answer

Just set the dragging version of your map to false , but be sure to save the touchZoom option as true . This will disable one-finger drag, allowing the user to pinch with two fingers, which also move the map around.

If you want to use this behavior only on mobile devices, use L.Browser.mobile to set the value of the dragging parameter, as in

 var map = L.map('map', { dragging: !L.Browser.mobile }); 
+4
source share

All Articles