Leaflet JS - Implementing Gesture Handling to enforce 2 fingered scrolling

前端 未结 1 1503
有刺的猬
有刺的猬 2021-01-18 06:30

You know when you\'re on a mobile device and you scroll down a web page which has a google map. The map goes dark and tells you \"Use two fingers to move the map\".

<
1条回答
  •  囚心锁ツ
    2021-01-18 06:56

    The key to this was ensuring that dragging, tap and scrollWheelZoom are disabled when intitializing the map.

    Then temporarily re-enabling them when 2 fingered dragging, or scrolling with command or ctrl key is detected.

    I've now packaged this solution into a leaflet plugin.

    https://github.com/elmarquis/Leaflet.GestureHandling

    0 讨论(0)
提交回复
热议问题