Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable single finger dragging on touch devices

When a user is dragging the page on mobile browsers, it acts like scrolling but when it comes to the map and the users finger is on the map, leaflet's dragging event is fired and scrolling is not.

I want to disable single finger dragging but keep double fingers dragging so that the user can drag the map with 2 fingers whilst scrolling the page with 1 finger.

Question: Is there any ways to do the above?

like image 248
Ray Lee Avatar asked Feb 17 '17 21:02

Ray Lee


1 Answers

Yes, there is. Just set dragging option to false and use tap option to keep scrolling up or down.

var oMap = new L.Map('Map', {
       '...Other options...'
       dragging: false,
       tap: false
    });

This should do what you want.

like image 124
Lorran Pegoretti Avatar answered Nov 19 '22 15:11

Lorran Pegoretti