Socket
Socket
Sign inDemoInstall

@raruto/leaflet-gesture-handling

Package Overview
Dependencies
1
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.2 to 1.3.3

test/index.html

12

dist/leaflet-gesture-handling.js

@@ -364,2 +364,6 @@ (function (global, factory) {

// Prevent page scroll on "leaflet-popup-content"
this._map.on("popupopen", this._handleScrollOnPopup, this);
this._map.on("popupclose", this._handleScrollOnPopup, this);
// Reset any previously added fullscreen events

@@ -391,2 +395,5 @@ L.DomEvent.off(this._map, "enterFullscreen", this._onEnterFullscreen, this);

this._map.off("popupopen", this._handleScrollOnPopup, this);
this._map.off("popupclose", this._handleScrollOnPopup, this);
L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling");

@@ -561,2 +568,7 @@ },

_handleScrollOnPopup: function(e) {
L.DomEvent[e.type == 'popupopen' ? 'on' : 'off']
(e.popup._contentNode, "wheel", this._handleScroll, this);
},
_handleMouseOver: function(e) {

@@ -563,0 +575,0 @@ this._enableInteractions();

2

dist/leaflet-gesture-handling.min.js

@@ -1,2 +0,2 @@

!function(t,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((t=t||self)["leaflet-gesture-handling"]={})}(this,(function(t){"use strict";var a={ar:{touch:"استخدم إصبعين لتحريك الخريطة",scroll:"‏استخدم ctrl + scroll لتصغير/تكبير الخريطة",scrollMac:"يمكنك استخدام ⌘ + التمرير لتكبير/تصغير الخريطة"},bg:{touch:"Използвайте два пръста, за да преместите картата",scroll:"Задръжте бутона Ctrl натиснат, докато превъртате, за да промените мащаба на картата",scrollMac:"Задръжте бутона ⌘ натиснат, докато превъртате, за да промените мащаба на картата"},bn:{touch:"মানচিত্রটিকে সরাতে দুটি আঙ্গুল ব্যবহার করুন",scroll:"ম্যাপ জুম করতে ctrl + scroll ব্যবহার করুন",scrollMac:"ম্যাপে জুম করতে ⌘ বোতাম টিপে স্ক্রল করুন"},ca:{touch:"Fes servir dos dits per moure el mapa",scroll:"Prem la tecla Control mentre et desplaces per apropar i allunyar el mapa",scrollMac:"Prem la tecla ⌘ mentre et desplaces per apropar i allunyar el mapa"},cs:{touch:"K posunutí mapy použijte dva prsty",scroll:"Velikost zobrazení mapy změňte podržením klávesy Ctrl a posouváním kolečka myši",scrollMac:"Velikost zobrazení mapy změníte podržením klávesy ⌘ a posunutím kolečka myši / touchpadu"},da:{touch:"Brug to fingre til at flytte kortet",scroll:"Brug ctrl + rullefunktionen til at zoome ind og ud på kortet",scrollMac:"Brug ⌘ + rullefunktionen til at zoome ind og ud på kortet"},de:{touch:"Verschieben der Karte mit zwei Fingern",scroll:"Verwende Strg + Scroll zum Zoomen der Karte",scrollMac:"Verwende ⌘ + Scroll zum Zoomen der Karte"},el:{touch:"Χρησιμοποιήστε δύο δάχτυλα για μετακίνηση στον χάρτη",scroll:"Χρησιμοποιήστε το πλήκτρο Ctrl και κύλιση, για να μεγεθύνετε τον χάρτη",scrollMac:"Χρησιμοποιήστε το πλήκτρο ⌘ + κύλιση για εστίαση στον χάρτη"},en:{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-AU":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-GB":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},es:{touch:"Para mover el mapa, utiliza dos dedos",scroll:"Mantén pulsada la tecla Ctrl mientras te desplazas para acercar o alejar el mapa",scrollMac:"Mantén pulsada la tecla ⌘ mientras te desplazas para acercar o alejar el mapa"},eu:{touch:"Erabili bi hatz mapa mugitzeko",scroll:"Mapan zooma aplikatzeko, sakatu Ktrl eta egin gora edo behera",scrollMac:"Eduki sakatuta ⌘ eta egin gora eta behera mapa handitu eta txikitzeko"},fa:{touch:"برای حرکت دادن نقشه از دو انگشت استفاده کنید.",scroll:"‏برای بزرگ‌نمایی نقشه از ctrl + scroll استفاده کنید",scrollMac:"برای بزرگ‌نمایی نقشه، از ⌘ + پیمایش استفاده کنید."},fi:{touch:"Siirrä karttaa kahdella sormella.",scroll:"Zoomaa karttaa painamalla Ctrl-painiketta ja vierittämällä.",scrollMac:"Zoomaa karttaa pitämällä painike ⌘ painettuna ja vierittämällä."},fil:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},fr:{touch:"Utilisez deux doigts pour déplacer la carte",scroll:"Vous pouvez zoomer sur la carte à l'aide de CTRL+Molette de défilement",scrollMac:"Vous pouvez zoomer sur la carte à l'aide de ⌘+Molette de défilement"},gl:{touch:"Utiliza dous dedos para mover o mapa",scroll:"Preme Ctrl mentres te desprazas para ampliar o mapa",scrollMac:"Preme ⌘ e desprázate para ampliar o mapa"},gu:{touch:"નકશો ખસેડવા બે આંગળીઓનો ઉપયોગ કરો",scroll:"નકશાને ઝૂમ કરવા માટે ctrl + સ્ક્રોલનો ઉપયોગ કરો",scrollMac:"નકશાને ઝૂમ કરવા ⌘ + સ્ક્રોલનો ઉપયોગ કરો"},hi:{touch:"मैप एक जगह से दूसरी जगह ले जाने के लिए दो उंगलियों का इस्तेमाल करें",scroll:"मैप को ज़ूम करने के लिए ctrl + स्क्रोल का उपयोग करें",scrollMac:"मैप को ज़ूम करने के लिए ⌘ + स्क्रोल का उपयोग करें"},hr:{touch:"Pomičite kartu pomoću dva prsta",scroll:"Upotrijebite Ctrl i klizač miša da biste zumirali kartu",scrollMac:"Upotrijebite gumb ⌘ dok se pomičete za zumiranje karte"},hu:{touch:"Két ujjal mozgassa a térképet",scroll:"A térkép a ctrl + görgetés használatával nagyítható",scrollMac:"A térkép a ⌘ + görgetés használatával nagyítható"},id:{touch:"Gunakan dua jari untuk menggerakkan peta",scroll:"Gunakan ctrl + scroll untuk memperbesar atau memperkecil peta",scrollMac:"Gunakan ⌘ + scroll untuk memperbesar atau memperkecil peta"},it:{touch:"Utilizza due dita per spostare la mappa",scroll:"Utilizza CTRL + scorrimento per eseguire lo zoom della mappa",scrollMac:"Utilizza ⌘ + scorrimento per eseguire lo zoom della mappa"},iw:{touch:"הזז את המפה באמצעות שתי אצבעות",scroll:"‏אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ctrl וגלילה",scrollMac:"אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ⌘ וגלילה"},ja:{touch:"地図を移動させるには指 2 本で操作します",scroll:"地図をズームするには、Ctrl キーを押しながらスクロールしてください",scrollMac:"地図をズームするには、⌘ キーを押しながらスクロールしてください"},kn:{touch:"Use two fingers to move the map",scroll:"Use Ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},ko:{touch:"지도를 움직이려면 두 손가락을 사용하세요.",scroll:"지도를 확대/축소하려면 Ctrl을 누른 채 스크롤하세요.",scrollMac:"지도를 확대하려면 ⌘ + 스크롤 사용"},lt:{touch:"Perkelkite žemėlapį dviem pirštais",scroll:"Slinkite nuspaudę klavišą „Ctrl“, kad pakeistumėte žemėlapio mastelį",scrollMac:"Paspauskite klavišą ⌘ ir slinkite, kad priartintumėte žemėlapį"},lv:{touch:"Lai pārvietotu karti, bīdiet to ar diviem pirkstiem",scroll:"Kartes tālummaiņai izmantojiet ctrl + ritināšanu",scrollMac:"Lai veiktu kartes tālummaiņu, izmantojiet ⌘ + ritināšanu"},ml:{touch:"മാപ്പ് നീക്കാൻ രണ്ട് വിരലുകൾ ഉപയോഗിക്കുക",scroll:"കൺട്രോൾ + സ്‌ക്രോൾ ഉപയോഗിച്ച് ‌മാപ്പ് ‌സൂം ചെയ്യുക",scrollMac:"⌘ + സ്‌ക്രോൾ ഉപയോഗിച്ച് ‌മാപ്പ് ‌സൂം ചെയ്യുക"},mr:{touch:"नकाशा हलविण्यासाठी दोन बोटे वापरा",scroll:"नकाशा झूम करण्यासाठी ctrl + scroll वापरा",scrollMac:"नकाशावर झूम करण्यासाठी ⌘ + स्क्रोल वापरा"},nl:{touch:"Gebruik twee vingers om de kaart te verplaatsen",scroll:"Gebruik Ctrl + scrollen om in- en uit te zoomen op de kaart",scrollMac:"Gebruik ⌘ + scrollen om in en uit te zoomen op de kaart"},no:{touch:"Bruk to fingre for å flytte kartet",scroll:"Hold ctrl-tasten inne og rull for å zoome på kartet",scrollMac:"Hold inne ⌘-tasten og rull for å zoome på kartet"},pl:{touch:"Przesuń mapę dwoma palcami",scroll:"Naciśnij CTRL i przewiń, by przybliżyć mapę",scrollMac:"Naciśnij ⌘ i przewiń, by przybliżyć mapę"},pt:{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-BR":{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-PT":{touch:"Utilize dois dedos para mover o mapa",scroll:"Utilizar ctrl + deslocar para aumentar/diminuir zoom do mapa",scrollMac:"Utilize ⌘ + deslocar para aumentar/diminuir o zoom do mapa"},ro:{touch:"Folosiți două degete pentru a deplasa harta",scroll:"Apăsați tasta ctrl și derulați simultan pentru a mări harta",scrollMac:"Folosiți ⌘ și derulați pentru a mări/micșora harta"},ru:{touch:"Чтобы переместить карту, проведите по ней двумя пальцами",scroll:"Чтобы изменить масштаб, прокручивайте карту, удерживая клавишу Ctrl.",scrollMac:"Чтобы изменить масштаб, нажмите ⌘ + прокрутка"},sk:{touch:"Mapu môžete posunúť dvoma prstami",scroll:"Ak chcete priblížiť mapu, stlačte kláves ctrl a posúvajte",scrollMac:"Ak chcete priblížiť mapu, stlačte kláves ⌘ a posúvajte kolieskom myši"},sl:{touch:"Premaknite zemljevid z dvema prstoma",scroll:"Zemljevid povečate tako, da držite tipko Ctrl in vrtite kolesce na miški",scrollMac:"Uporabite ⌘ + funkcijo pomika, da povečate ali pomanjšate zemljevid"},sr:{touch:"Мапу померајте помоћу два прста",scroll:"Притисните ctrl тастер док померате да бисте зумирали мапу",scrollMac:"Притисните тастер ⌘ док померате да бисте зумирали мапу"},sv:{touch:"Använd två fingrar för att flytta kartan",scroll:"Använd ctrl + rulla för att zooma kartan",scrollMac:"Använd ⌘ + rulla för att zooma på kartan"},ta:{touch:"மேப்பை நகர்த்த இரண்டு விரல்களைப் பயன்படுத்தவும்",scroll:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ctrl பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்",scrollMac:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ⌘ பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்"},te:{touch:"మ్యాప్‌ని తరలించడం కోసం రెండు వేళ్లను ఉపయోగించండి",scroll:"మ్యాప్‌ని జూమ్ చేయడానికి ctrl బటన్‌ను నొక్కి ఉంచి, స్క్రోల్ చేయండి",scrollMac:"మ్యాప్ జూమ్ చేయాలంటే ⌘ + స్క్రోల్ ఉపయోగించండి"},th:{touch:"ใช้ 2 นิ้วเพื่อเลื่อนแผนที่",scroll:"กด Ctrl ค้างไว้ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่",scrollMac:"กด ⌘ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่"},tl:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},tr:{touch:"Haritada gezinmek için iki parmağınızı kullanın",scroll:"Haritayı yakınlaştırmak için ctrl + kaydırma kombinasyonunu kullanın",scrollMac:"Haritayı yakınlaştırmak için ⌘ tuşuna basıp ekranı kaydırın"},uk:{touch:"Переміщуйте карту двома пальцями",scroll:"Щоб змінювати масштаб карти, прокручуйте коліщатко миші, утримуючи клавішу Ctrl",scrollMac:"Щоб змінити масштаб карти, використовуйте ⌘ + прокручування"},vi:{touch:"Sử dụng hai ngón tay để di chuyển bản đồ",scroll:"Sử dụng ctrl + cuộn để thu phóng bản đồ",scrollMac:"Sử dụng ⌘ + cuộn để thu phóng bản đồ"},"zh-CN":{touch:"使用双指移动地图",scroll:"按住 Ctrl 并滚动鼠标滚轮才可缩放地图",scrollMac:"按住 ⌘ 并滚动鼠标滚轮才可缩放地图"},"zh-TW":{touch:"同時以兩指移動地圖",scroll:"按住 ctrl 鍵加上捲動滑鼠可以縮放地圖",scrollMac:"按 ⌘ 加上滾動捲軸可以縮放地圖"}};window.LanguageContent=a;var e=!1,l={text:{},duration:1700},o=L.Handler.extend({_isScrolling:!1,_isTouching:!1,_isFading:!1,addHooks:function(){this._handleTouch=L.bind(this._handleTouch,this),this._setGestureHandlingOptions(),this._disableInteractions(),this._map._container.addEventListener("touchstart",this._handleTouch),this._map._container.addEventListener("touchmove",this._handleTouch),this._map._container.addEventListener("touchend",this._handleTouch),this._map._container.addEventListener("touchcancel",this._handleTouch),this._map._container.addEventListener("click",this._handleTouch),L.DomEvent.on(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.on(this._map._container,"mouseenter",this._handleMouseOver,this),L.DomEvent.on(this._map._container,"mouseleave",this._handleMouseOut,this),L.DomEvent.on(this._map,"movestart",this._handleDragging,this),L.DomEvent.on(this._map,"move",this._handleDragging,this),L.DomEvent.on(this._map,"moveend",this._handleDragging,this),L.DomEvent.off(this._map,"enterFullscreen",this._onEnterFullscreen,this),L.DomEvent.off(this._map,"exitFullscreen",this._onExitFullscreen,this),L.DomEvent.on(this._map,"enterFullscreen",this._onEnterFullscreen,this),L.DomEvent.on(this._map,"exitFullscreen",this._onExitFullscreen,this),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling")},removeHooks:function(){this._enableInteractions(),this._map._container.removeEventListener("touchstart",this._handleTouch),this._map._container.removeEventListener("touchmove",this._handleTouch),this._map._container.removeEventListener("touchend",this._handleTouch),this._map._container.removeEventListener("touchcancel",this._handleTouch),this._map._container.removeEventListener("click",this._handleTouch),L.DomEvent.off(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.off(this._map._container,"mouseenter",this._handleMouseOver,this),L.DomEvent.off(this._map._container,"mouseleave",this._handleMouseOut,this),L.DomEvent.off(this._map,"movestart",this._handleDragging,this),L.DomEvent.off(this._map,"move",this._handleDragging,this),L.DomEvent.off(this._map,"moveend",this._handleDragging,this),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling")},_handleDragging:function(t){"movestart"==t.type||"move"==t.type?e=!0:"moveend"==t.type&&(e=!1)},_disableInteractions:function(){this._map.dragging.disable(),this._map.scrollWheelZoom.disable(),this._map.tap&&this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable(),this._map.scrollWheelZoom.enable(),this._map.tap&&this._map.tap.enable()},_enableWarning:function(t){clearTimeout(this._isFading),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-"+t),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-warning")},_disableWarning:function(t,a){clearTimeout(this._isFading),this._isFading=setTimeout(L.bind((function(t){L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-"+t)}),this,t),a||this._map.options.gestureHandlingOptions.duration),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-warning")},_isLanguageContent:function(t){return t&&t.touch&&t.scroll&&t.scrollMac},_isMacUser:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},_parseGestureHandlingOptions:function(){var t=L.extend(this._map.options.gestureHandlingOptions,l);return this._map.options.gestureHandlingText&&(t.text=this._map.options.gestureHandlingText),t},_setGestureHandlingOptions:function(){var t=this._parseGestureHandlingOptions(),a=this._isLanguageContent(t.text)?t.text:this._getLanguageContent(t.locale);this._map._container.setAttribute("data-gesture-handling-touch-content",a.touch),this._map._container.setAttribute("data-gesture-handling-scroll-content",a.scroll),this._touchWarning=a.touch,this._scrollWarning=a.scroll},_getUserLanguage:function(){return navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage},_getLanguageContent:function(t){t=t||this._getUserLanguage()||"en";var e=a[t];return(e=(e=e||-1===t.indexOf("-")?e:a[t.split("-")[0]])||a.en).scroll=this._isMacUser()?e.scrollMac:e.scroll,e},_hasClass:function(t,a){for(var e=0;e<a.length;e++)if(L.DomUtil.hasClass(t,a[e]))return!0;return!1},_handleTouch:function(t){this._hasClass(t.target,["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"])?L.DomUtil.hasClass(t.target,"leaflet-interactive")&&"touchmove"===t.type&&1===t.touches.length?this._enableTouchWarning():this._disableTouchWarning():"touchmove"!==t.type&&"touchstart"!==t.type?this._disableTouchWarning():1===t.touches.length?this._enableTouchWarning():(this._disableTouchWarning(),this._enableInteractions())},_enableTouchWarning:function(){this._enableWarning("touch"),this._disableInteractions()},_disableTouchWarning:function(t){clearTimeout(this._isTouching),this._isTouching=setTimeout(L.bind((function(){this._disableWarning("touch")}),this),t||0)},_enableScrollWarning:function(){this._enableWarning("scroll"),this._map.scrollWheelZoom.disable()},_disableScrollWarning:function(t){clearTimeout(this._isScrolling),this._isScrolling=setTimeout(L.bind((function(){this._disableWarning("scroll"),this._map.scrollWheelZoom.enable()}),this),t||0)},_handleScroll:function(t){t.metaKey||t.ctrlKey?(t.preventDefault(),this._disableScrollWarning()):(this._enableScrollWarning(),this._disableScrollWarning(this._map.options.gestureHandlingOptions.duration))},_handleMouseOver:function(t){this._enableInteractions()},_handleMouseOut:function(t){e||this._disableInteractions()},_onExitFullscreen:function(){this._map.options.gestureHandling&&this._map.gestureHandling.enable()},_onEnterFullscreen:function(){this._map.options.gestureHandling&&this._map.gestureHandling.disable()}});L.Map.mergeOptions({gestureHandlingOptions:l}),L.Map.addInitHook("addHandler","gestureHandling",o),t.GestureHandling=o,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((t=t||self)["leaflet-gesture-handling"]={})}(this,(function(t){"use strict";var a={ar:{touch:"استخدم إصبعين لتحريك الخريطة",scroll:"‏استخدم ctrl + scroll لتصغير/تكبير الخريطة",scrollMac:"يمكنك استخدام ⌘ + التمرير لتكبير/تصغير الخريطة"},bg:{touch:"Използвайте два пръста, за да преместите картата",scroll:"Задръжте бутона Ctrl натиснат, докато превъртате, за да промените мащаба на картата",scrollMac:"Задръжте бутона ⌘ натиснат, докато превъртате, за да промените мащаба на картата"},bn:{touch:"মানচিত্রটিকে সরাতে দুটি আঙ্গুল ব্যবহার করুন",scroll:"ম্যাপ জুম করতে ctrl + scroll ব্যবহার করুন",scrollMac:"ম্যাপে জুম করতে ⌘ বোতাম টিপে স্ক্রল করুন"},ca:{touch:"Fes servir dos dits per moure el mapa",scroll:"Prem la tecla Control mentre et desplaces per apropar i allunyar el mapa",scrollMac:"Prem la tecla ⌘ mentre et desplaces per apropar i allunyar el mapa"},cs:{touch:"K posunutí mapy použijte dva prsty",scroll:"Velikost zobrazení mapy změňte podržením klávesy Ctrl a posouváním kolečka myši",scrollMac:"Velikost zobrazení mapy změníte podržením klávesy ⌘ a posunutím kolečka myši / touchpadu"},da:{touch:"Brug to fingre til at flytte kortet",scroll:"Brug ctrl + rullefunktionen til at zoome ind og ud på kortet",scrollMac:"Brug ⌘ + rullefunktionen til at zoome ind og ud på kortet"},de:{touch:"Verschieben der Karte mit zwei Fingern",scroll:"Verwende Strg + Scroll zum Zoomen der Karte",scrollMac:"Verwende ⌘ + Scroll zum Zoomen der Karte"},el:{touch:"Χρησιμοποιήστε δύο δάχτυλα για μετακίνηση στον χάρτη",scroll:"Χρησιμοποιήστε το πλήκτρο Ctrl και κύλιση, για να μεγεθύνετε τον χάρτη",scrollMac:"Χρησιμοποιήστε το πλήκτρο ⌘ + κύλιση για εστίαση στον χάρτη"},en:{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-AU":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},"en-GB":{touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},es:{touch:"Para mover el mapa, utiliza dos dedos",scroll:"Mantén pulsada la tecla Ctrl mientras te desplazas para acercar o alejar el mapa",scrollMac:"Mantén pulsada la tecla ⌘ mientras te desplazas para acercar o alejar el mapa"},eu:{touch:"Erabili bi hatz mapa mugitzeko",scroll:"Mapan zooma aplikatzeko, sakatu Ktrl eta egin gora edo behera",scrollMac:"Eduki sakatuta ⌘ eta egin gora eta behera mapa handitu eta txikitzeko"},fa:{touch:"برای حرکت دادن نقشه از دو انگشت استفاده کنید.",scroll:"‏برای بزرگ‌نمایی نقشه از ctrl + scroll استفاده کنید",scrollMac:"برای بزرگ‌نمایی نقشه، از ⌘ + پیمایش استفاده کنید."},fi:{touch:"Siirrä karttaa kahdella sormella.",scroll:"Zoomaa karttaa painamalla Ctrl-painiketta ja vierittämällä.",scrollMac:"Zoomaa karttaa pitämällä painike ⌘ painettuna ja vierittämällä."},fil:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},fr:{touch:"Utilisez deux doigts pour déplacer la carte",scroll:"Vous pouvez zoomer sur la carte à l'aide de CTRL+Molette de défilement",scrollMac:"Vous pouvez zoomer sur la carte à l'aide de ⌘+Molette de défilement"},gl:{touch:"Utiliza dous dedos para mover o mapa",scroll:"Preme Ctrl mentres te desprazas para ampliar o mapa",scrollMac:"Preme ⌘ e desprázate para ampliar o mapa"},gu:{touch:"નકશો ખસેડવા બે આંગળીઓનો ઉપયોગ કરો",scroll:"નકશાને ઝૂમ કરવા માટે ctrl + સ્ક્રોલનો ઉપયોગ કરો",scrollMac:"નકશાને ઝૂમ કરવા ⌘ + સ્ક્રોલનો ઉપયોગ કરો"},hi:{touch:"मैप एक जगह से दूसरी जगह ले जाने के लिए दो उंगलियों का इस्तेमाल करें",scroll:"मैप को ज़ूम करने के लिए ctrl + स्क्रोल का उपयोग करें",scrollMac:"मैप को ज़ूम करने के लिए ⌘ + स्क्रोल का उपयोग करें"},hr:{touch:"Pomičite kartu pomoću dva prsta",scroll:"Upotrijebite Ctrl i klizač miša da biste zumirali kartu",scrollMac:"Upotrijebite gumb ⌘ dok se pomičete za zumiranje karte"},hu:{touch:"Két ujjal mozgassa a térképet",scroll:"A térkép a ctrl + görgetés használatával nagyítható",scrollMac:"A térkép a ⌘ + görgetés használatával nagyítható"},id:{touch:"Gunakan dua jari untuk menggerakkan peta",scroll:"Gunakan ctrl + scroll untuk memperbesar atau memperkecil peta",scrollMac:"Gunakan ⌘ + scroll untuk memperbesar atau memperkecil peta"},it:{touch:"Utilizza due dita per spostare la mappa",scroll:"Utilizza CTRL + scorrimento per eseguire lo zoom della mappa",scrollMac:"Utilizza ⌘ + scorrimento per eseguire lo zoom della mappa"},iw:{touch:"הזז את המפה באמצעות שתי אצבעות",scroll:"‏אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ctrl וגלילה",scrollMac:"אפשר לשנות את מרחק התצוגה במפה באמצעות מקש ⌘ וגלילה"},ja:{touch:"地図を移動させるには指 2 本で操作します",scroll:"地図をズームするには、Ctrl キーを押しながらスクロールしてください",scrollMac:"地図をズームするには、⌘ キーを押しながらスクロールしてください"},kn:{touch:"Use two fingers to move the map",scroll:"Use Ctrl + scroll to zoom the map",scrollMac:"Use ⌘ + scroll to zoom the map"},ko:{touch:"지도를 움직이려면 두 손가락을 사용하세요.",scroll:"지도를 확대/축소하려면 Ctrl을 누른 채 스크롤하세요.",scrollMac:"지도를 확대하려면 ⌘ + 스크롤 사용"},lt:{touch:"Perkelkite žemėlapį dviem pirštais",scroll:"Slinkite nuspaudę klavišą „Ctrl“, kad pakeistumėte žemėlapio mastelį",scrollMac:"Paspauskite klavišą ⌘ ir slinkite, kad priartintumėte žemėlapį"},lv:{touch:"Lai pārvietotu karti, bīdiet to ar diviem pirkstiem",scroll:"Kartes tālummaiņai izmantojiet ctrl + ritināšanu",scrollMac:"Lai veiktu kartes tālummaiņu, izmantojiet ⌘ + ritināšanu"},ml:{touch:"മാപ്പ് നീക്കാൻ രണ്ട് വിരലുകൾ ഉപയോഗിക്കുക",scroll:"കൺട്രോൾ + സ്‌ക്രോൾ ഉപയോഗിച്ച് ‌മാപ്പ് ‌സൂം ചെയ്യുക",scrollMac:"⌘ + സ്‌ക്രോൾ ഉപയോഗിച്ച് ‌മാപ്പ് ‌സൂം ചെയ്യുക"},mr:{touch:"नकाशा हलविण्यासाठी दोन बोटे वापरा",scroll:"नकाशा झूम करण्यासाठी ctrl + scroll वापरा",scrollMac:"नकाशावर झूम करण्यासाठी ⌘ + स्क्रोल वापरा"},nl:{touch:"Gebruik twee vingers om de kaart te verplaatsen",scroll:"Gebruik Ctrl + scrollen om in- en uit te zoomen op de kaart",scrollMac:"Gebruik ⌘ + scrollen om in en uit te zoomen op de kaart"},no:{touch:"Bruk to fingre for å flytte kartet",scroll:"Hold ctrl-tasten inne og rull for å zoome på kartet",scrollMac:"Hold inne ⌘-tasten og rull for å zoome på kartet"},pl:{touch:"Przesuń mapę dwoma palcami",scroll:"Naciśnij CTRL i przewiń, by przybliżyć mapę",scrollMac:"Naciśnij ⌘ i przewiń, by przybliżyć mapę"},pt:{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-BR":{touch:"Use dois dedos para mover o mapa",scroll:"Pressione Ctrl e role a tela simultaneamente para aplicar zoom no mapa",scrollMac:"Use ⌘ e role a tela simultaneamente para aplicar zoom no mapa"},"pt-PT":{touch:"Utilize dois dedos para mover o mapa",scroll:"Utilizar ctrl + deslocar para aumentar/diminuir zoom do mapa",scrollMac:"Utilize ⌘ + deslocar para aumentar/diminuir o zoom do mapa"},ro:{touch:"Folosiți două degete pentru a deplasa harta",scroll:"Apăsați tasta ctrl și derulați simultan pentru a mări harta",scrollMac:"Folosiți ⌘ și derulați pentru a mări/micșora harta"},ru:{touch:"Чтобы переместить карту, проведите по ней двумя пальцами",scroll:"Чтобы изменить масштаб, прокручивайте карту, удерживая клавишу Ctrl.",scrollMac:"Чтобы изменить масштаб, нажмите ⌘ + прокрутка"},sk:{touch:"Mapu môžete posunúť dvoma prstami",scroll:"Ak chcete priblížiť mapu, stlačte kláves ctrl a posúvajte",scrollMac:"Ak chcete priblížiť mapu, stlačte kláves ⌘ a posúvajte kolieskom myši"},sl:{touch:"Premaknite zemljevid z dvema prstoma",scroll:"Zemljevid povečate tako, da držite tipko Ctrl in vrtite kolesce na miški",scrollMac:"Uporabite ⌘ + funkcijo pomika, da povečate ali pomanjšate zemljevid"},sr:{touch:"Мапу померајте помоћу два прста",scroll:"Притисните ctrl тастер док померате да бисте зумирали мапу",scrollMac:"Притисните тастер ⌘ док померате да бисте зумирали мапу"},sv:{touch:"Använd två fingrar för att flytta kartan",scroll:"Använd ctrl + rulla för att zooma kartan",scrollMac:"Använd ⌘ + rulla för att zooma på kartan"},ta:{touch:"மேப்பை நகர்த்த இரண்டு விரல்களைப் பயன்படுத்தவும்",scroll:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ctrl பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்",scrollMac:"மேப்பை பெரிதாக்கி/சிறிதாக்கிப் பார்க்க, ⌘ பட்டனைப் பிடித்தபடி, மேலே/கீழே ஸ்க்ரால் செய்யவும்"},te:{touch:"మ్యాప్‌ని తరలించడం కోసం రెండు వేళ్లను ఉపయోగించండి",scroll:"మ్యాప్‌ని జూమ్ చేయడానికి ctrl బటన్‌ను నొక్కి ఉంచి, స్క్రోల్ చేయండి",scrollMac:"మ్యాప్ జూమ్ చేయాలంటే ⌘ + స్క్రోల్ ఉపయోగించండి"},th:{touch:"ใช้ 2 นิ้วเพื่อเลื่อนแผนที่",scroll:"กด Ctrl ค้างไว้ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่",scrollMac:"กด ⌘ แล้วเลื่อนหน้าจอเพื่อซูมแผนที่"},tl:{touch:"Gumamit ng dalawang daliri upang iusog ang mapa",scroll:"Gamitin ang ctrl + scroll upang i-zoom ang mapa",scrollMac:"Gamitin ang ⌘ + scroll upang i-zoom ang mapa"},tr:{touch:"Haritada gezinmek için iki parmağınızı kullanın",scroll:"Haritayı yakınlaştırmak için ctrl + kaydırma kombinasyonunu kullanın",scrollMac:"Haritayı yakınlaştırmak için ⌘ tuşuna basıp ekranı kaydırın"},uk:{touch:"Переміщуйте карту двома пальцями",scroll:"Щоб змінювати масштаб карти, прокручуйте коліщатко миші, утримуючи клавішу Ctrl",scrollMac:"Щоб змінити масштаб карти, використовуйте ⌘ + прокручування"},vi:{touch:"Sử dụng hai ngón tay để di chuyển bản đồ",scroll:"Sử dụng ctrl + cuộn để thu phóng bản đồ",scrollMac:"Sử dụng ⌘ + cuộn để thu phóng bản đồ"},"zh-CN":{touch:"使用双指移动地图",scroll:"按住 Ctrl 并滚动鼠标滚轮才可缩放地图",scrollMac:"按住 ⌘ 并滚动鼠标滚轮才可缩放地图"},"zh-TW":{touch:"同時以兩指移動地圖",scroll:"按住 ctrl 鍵加上捲動滑鼠可以縮放地圖",scrollMac:"按 ⌘ 加上滾動捲軸可以縮放地圖"}};window.LanguageContent=a;var e=!1,o={text:{},duration:1700},l=L.Handler.extend({_isScrolling:!1,_isTouching:!1,_isFading:!1,addHooks:function(){this._handleTouch=L.bind(this._handleTouch,this),this._setGestureHandlingOptions(),this._disableInteractions(),this._map._container.addEventListener("touchstart",this._handleTouch),this._map._container.addEventListener("touchmove",this._handleTouch),this._map._container.addEventListener("touchend",this._handleTouch),this._map._container.addEventListener("touchcancel",this._handleTouch),this._map._container.addEventListener("click",this._handleTouch),L.DomEvent.on(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.on(this._map._container,"mouseenter",this._handleMouseOver,this),L.DomEvent.on(this._map._container,"mouseleave",this._handleMouseOut,this),L.DomEvent.on(this._map,"movestart",this._handleDragging,this),L.DomEvent.on(this._map,"move",this._handleDragging,this),L.DomEvent.on(this._map,"moveend",this._handleDragging,this),this._map.on("popupopen",this._handleScrollOnPopup,this),this._map.on("popupclose",this._handleScrollOnPopup,this),L.DomEvent.off(this._map,"enterFullscreen",this._onEnterFullscreen,this),L.DomEvent.off(this._map,"exitFullscreen",this._onExitFullscreen,this),L.DomEvent.on(this._map,"enterFullscreen",this._onEnterFullscreen,this),L.DomEvent.on(this._map,"exitFullscreen",this._onExitFullscreen,this),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling")},removeHooks:function(){this._enableInteractions(),this._map._container.removeEventListener("touchstart",this._handleTouch),this._map._container.removeEventListener("touchmove",this._handleTouch),this._map._container.removeEventListener("touchend",this._handleTouch),this._map._container.removeEventListener("touchcancel",this._handleTouch),this._map._container.removeEventListener("click",this._handleTouch),L.DomEvent.off(this._map._container,"wheel",this._handleScroll,this),L.DomEvent.off(this._map._container,"mouseenter",this._handleMouseOver,this),L.DomEvent.off(this._map._container,"mouseleave",this._handleMouseOut,this),L.DomEvent.off(this._map,"movestart",this._handleDragging,this),L.DomEvent.off(this._map,"move",this._handleDragging,this),L.DomEvent.off(this._map,"moveend",this._handleDragging,this),this._map.off("popupopen",this._handleScrollOnPopup,this),this._map.off("popupclose",this._handleScrollOnPopup,this),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling")},_handleDragging:function(t){"movestart"==t.type||"move"==t.type?e=!0:"moveend"==t.type&&(e=!1)},_disableInteractions:function(){this._map.dragging.disable(),this._map.scrollWheelZoom.disable(),this._map.tap&&this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable(),this._map.scrollWheelZoom.enable(),this._map.tap&&this._map.tap.enable()},_enableWarning:function(t){clearTimeout(this._isFading),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-"+t),L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-warning")},_disableWarning:function(t,a){clearTimeout(this._isFading),this._isFading=setTimeout(L.bind((function(t){L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-"+t)}),this,t),a||this._map.options.gestureHandlingOptions.duration),L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-warning")},_isLanguageContent:function(t){return t&&t.touch&&t.scroll&&t.scrollMac},_isMacUser:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},_parseGestureHandlingOptions:function(){var t=L.extend(this._map.options.gestureHandlingOptions,o);return this._map.options.gestureHandlingText&&(t.text=this._map.options.gestureHandlingText),t},_setGestureHandlingOptions:function(){var t=this._parseGestureHandlingOptions(),a=this._isLanguageContent(t.text)?t.text:this._getLanguageContent(t.locale);this._map._container.setAttribute("data-gesture-handling-touch-content",a.touch),this._map._container.setAttribute("data-gesture-handling-scroll-content",a.scroll),this._touchWarning=a.touch,this._scrollWarning=a.scroll},_getUserLanguage:function(){return navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage},_getLanguageContent:function(t){t=t||this._getUserLanguage()||"en";var e=a[t];return(e=(e=e||-1===t.indexOf("-")?e:a[t.split("-")[0]])||a.en).scroll=this._isMacUser()?e.scrollMac:e.scroll,e},_hasClass:function(t,a){for(var e=0;e<a.length;e++)if(L.DomUtil.hasClass(t,a[e]))return!0;return!1},_handleTouch:function(t){this._hasClass(t.target,["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"])?L.DomUtil.hasClass(t.target,"leaflet-interactive")&&"touchmove"===t.type&&1===t.touches.length?this._enableTouchWarning():this._disableTouchWarning():"touchmove"!==t.type&&"touchstart"!==t.type?this._disableTouchWarning():1===t.touches.length?this._enableTouchWarning():(this._disableTouchWarning(),this._enableInteractions())},_enableTouchWarning:function(){this._enableWarning("touch"),this._disableInteractions()},_disableTouchWarning:function(t){clearTimeout(this._isTouching),this._isTouching=setTimeout(L.bind((function(){this._disableWarning("touch")}),this),t||0)},_enableScrollWarning:function(){this._enableWarning("scroll"),this._map.scrollWheelZoom.disable()},_disableScrollWarning:function(t){clearTimeout(this._isScrolling),this._isScrolling=setTimeout(L.bind((function(){this._disableWarning("scroll"),this._map.scrollWheelZoom.enable()}),this),t||0)},_handleScroll:function(t){t.metaKey||t.ctrlKey?(t.preventDefault(),this._disableScrollWarning()):(this._enableScrollWarning(),this._disableScrollWarning(this._map.options.gestureHandlingOptions.duration))},_handleScrollOnPopup:function(t){L.DomEvent["popupopen"==t.type?"on":"off"](t.popup._contentNode,"wheel",this._handleScroll,this)},_handleMouseOver:function(t){this._enableInteractions()},_handleMouseOut:function(t){e||this._disableInteractions()},_onExitFullscreen:function(){this._map.options.gestureHandling&&this._map.gestureHandling.enable()},_onEnterFullscreen:function(){this._map.options.gestureHandling&&this._map.gestureHandling.disable()}});L.Map.mergeOptions({gestureHandlingOptions:o}),L.Map.addInitHook("addHandler","gestureHandling",l),t.GestureHandling=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=leaflet-gesture-handling.min.js.map
{
"name": "@raruto/leaflet-gesture-handling",
"version": "1.3.2",
"version": "1.3.3",
"description": "A Leaflet plugin that allows to prevent default map scroll/touch behaviours",

@@ -5,0 +5,0 @@ "main": "./dist/leaflet-gesture-handling.min.js",

@@ -39,2 +39,6 @@ import LanguageContent from "./locales";

// Prevent page scroll on "leaflet-popup-content"
this._map.on("popupopen", this._handleScrollOnPopup, this);
this._map.on("popupclose", this._handleScrollOnPopup, this);
// Reset any previously added fullscreen events

@@ -66,2 +70,5 @@ L.DomEvent.off(this._map, "enterFullscreen", this._onEnterFullscreen, this);

this._map.off("popupopen", this._handleScrollOnPopup, this);
this._map.off("popupclose", this._handleScrollOnPopup, this);
L.DomUtil.removeClass(this._map._container, "leaflet-gesture-handling");

@@ -236,2 +243,7 @@ },

_handleScrollOnPopup: function(e) {
L.DomEvent[e.type == 'popupopen' ? 'on' : 'off']
(e.popup._contentNode, "wheel", this._handleScroll, this);
},
_handleMouseOver: function(e) {

@@ -238,0 +250,0 @@ this._enableInteractions();

'use strict';import LanguageContent from"./locales";window.LanguageContent=LanguageContent;var draggingMap=false;var gestureHandlingOptions={text:{},duration:1700};
export var GestureHandling=L.Handler.extend({_isScrolling:false,_isTouching:false,_isFading:false,addHooks:function(){this._handleTouch=L.bind(this._handleTouch,this);this._setGestureHandlingOptions();this._disableInteractions();this._map._container.addEventListener("touchstart",this._handleTouch);this._map._container.addEventListener("touchmove",this._handleTouch);this._map._container.addEventListener("touchend",this._handleTouch);this._map._container.addEventListener("touchcancel",this._handleTouch);
this._map._container.addEventListener("click",this._handleTouch);L.DomEvent.on(this._map._container,"wheel",this._handleScroll,this);L.DomEvent.on(this._map._container,"mouseenter",this._handleMouseOver,this);L.DomEvent.on(this._map._container,"mouseleave",this._handleMouseOut,this);L.DomEvent.on(this._map,"movestart",this._handleDragging,this);L.DomEvent.on(this._map,"move",this._handleDragging,this);L.DomEvent.on(this._map,"moveend",this._handleDragging,this);L.DomEvent.off(this._map,"enterFullscreen",
this._onEnterFullscreen,this);L.DomEvent.off(this._map,"exitFullscreen",this._onExitFullscreen,this);L.DomEvent.on(this._map,"enterFullscreen",this._onEnterFullscreen,this);L.DomEvent.on(this._map,"exitFullscreen",this._onExitFullscreen,this);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling")},removeHooks:function(){this._enableInteractions();this._map._container.removeEventListener("touchstart",this._handleTouch);this._map._container.removeEventListener("touchmove",this._handleTouch);
this._map._container.removeEventListener("touchend",this._handleTouch);this._map._container.removeEventListener("touchcancel",this._handleTouch);this._map._container.removeEventListener("click",this._handleTouch);L.DomEvent.off(this._map._container,"wheel",this._handleScroll,this);L.DomEvent.off(this._map._container,"mouseenter",this._handleMouseOver,this);L.DomEvent.off(this._map._container,"mouseleave",this._handleMouseOut,this);L.DomEvent.off(this._map,"movestart",this._handleDragging,this);L.DomEvent.off(this._map,
"move",this._handleDragging,this);L.DomEvent.off(this._map,"moveend",this._handleDragging,this);L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling")},_handleDragging:function(e){if(e.type=="movestart"||e.type=="move")draggingMap=true;else if(e.type=="moveend")draggingMap=false},_disableInteractions:function(){this._map.dragging.disable();this._map.scrollWheelZoom.disable();if(this._map.tap)this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable();this._map.scrollWheelZoom.enable();
if(this._map.tap)this._map.tap.enable()},_enableWarning:function(gesture){clearTimeout(this._isFading);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-"+gesture);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-warning")},_disableWarning:function(gesture,delay){clearTimeout(this._isFading);this._isFading=setTimeout(L.bind(function(gesture){L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-"+gesture)},this,gesture),delay||this._map.options.gestureHandlingOptions.duration);
L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-warning")},_isLanguageContent:function(text){return text&&text.touch&&text.scroll&&text.scrollMac},_isMacUser:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},_parseGestureHandlingOptions:function(){var options=L.extend(this._map.options.gestureHandlingOptions,gestureHandlingOptions);if(this._map.options.gestureHandlingText)options.text=this._map.options.gestureHandlingText;return options},_setGestureHandlingOptions:function(){var opts=
this._parseGestureHandlingOptions();var content=this._isLanguageContent(opts.text)?opts.text:this._getLanguageContent(opts.locale);this._map._container.setAttribute("data-gesture-handling-touch-content",content.touch);this._map._container.setAttribute("data-gesture-handling-scroll-content",content.scroll);this._touchWarning=content.touch;this._scrollWarning=content.scroll},_getUserLanguage:function(){return navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage},_getLanguageContent:function(lang){lang=
lang||this._getUserLanguage()||"en";var content=LanguageContent[lang];content=!content&&lang.indexOf("-")!==-1?LanguageContent[lang.split("-")[0]]:content;content=content||LanguageContent["en"];content.scroll=this._isMacUser()?content.scrollMac:content.scroll;return content},_hasClass:function(element,classList){for(var i=0;i<classList.length;i++)if(L.DomUtil.hasClass(element,classList[i]))return true;return false},_handleTouch:function(e){var ignore=this._hasClass(e.target,["leaflet-control-minimap",
"leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"]);if(ignore)if(L.DomUtil.hasClass(e.target,"leaflet-interactive")&&e.type==="touchmove"&&e.touches.length===1)this._enableTouchWarning();else this._disableTouchWarning();else if(e.type!=="touchmove"&&e.type!=="touchstart")this._disableTouchWarning();else if(e.touches.length===1)this._enableTouchWarning();else{this._disableTouchWarning();this._enableInteractions()}},
_enableTouchWarning:function(){this._enableWarning("touch");this._disableInteractions()},_disableTouchWarning:function(delay){clearTimeout(this._isTouching);this._isTouching=setTimeout(L.bind(function(){this._disableWarning("touch")},this),delay||0)},_enableScrollWarning:function(){this._enableWarning("scroll");this._map.scrollWheelZoom.disable()},_disableScrollWarning:function(delay){clearTimeout(this._isScrolling);this._isScrolling=setTimeout(L.bind(function(){this._disableWarning("scroll");this._map.scrollWheelZoom.enable()},
this),delay||0)},_handleScroll:function(e){if(e.metaKey||e.ctrlKey){e.preventDefault();this._disableScrollWarning()}else{this._enableScrollWarning();this._disableScrollWarning(this._map.options.gestureHandlingOptions.duration)}},_handleMouseOver:function(e){this._enableInteractions()},_handleMouseOut:function(e){if(!draggingMap)this._disableInteractions()},_onExitFullscreen:function(){if(this._map.options.gestureHandling)this._map.gestureHandling.enable()},_onEnterFullscreen:function(){if(this._map.options.gestureHandling)this._map.gestureHandling.disable()}});
L.Map.mergeOptions({gestureHandlingOptions:gestureHandlingOptions});L.Map.addInitHook("addHandler","gestureHandling",GestureHandling);
this._map._container.addEventListener("click",this._handleTouch);L.DomEvent.on(this._map._container,"wheel",this._handleScroll,this);L.DomEvent.on(this._map._container,"mouseenter",this._handleMouseOver,this);L.DomEvent.on(this._map._container,"mouseleave",this._handleMouseOut,this);L.DomEvent.on(this._map,"movestart",this._handleDragging,this);L.DomEvent.on(this._map,"move",this._handleDragging,this);L.DomEvent.on(this._map,"moveend",this._handleDragging,this);this._map.on("popupopen",this._handleScrollOnPopup,
this);this._map.on("popupclose",this._handleScrollOnPopup,this);L.DomEvent.off(this._map,"enterFullscreen",this._onEnterFullscreen,this);L.DomEvent.off(this._map,"exitFullscreen",this._onExitFullscreen,this);L.DomEvent.on(this._map,"enterFullscreen",this._onEnterFullscreen,this);L.DomEvent.on(this._map,"exitFullscreen",this._onExitFullscreen,this);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling")},removeHooks:function(){this._enableInteractions();this._map._container.removeEventListener("touchstart",
this._handleTouch);this._map._container.removeEventListener("touchmove",this._handleTouch);this._map._container.removeEventListener("touchend",this._handleTouch);this._map._container.removeEventListener("touchcancel",this._handleTouch);this._map._container.removeEventListener("click",this._handleTouch);L.DomEvent.off(this._map._container,"wheel",this._handleScroll,this);L.DomEvent.off(this._map._container,"mouseenter",this._handleMouseOver,this);L.DomEvent.off(this._map._container,"mouseleave",this._handleMouseOut,
this);L.DomEvent.off(this._map,"movestart",this._handleDragging,this);L.DomEvent.off(this._map,"move",this._handleDragging,this);L.DomEvent.off(this._map,"moveend",this._handleDragging,this);this._map.off("popupopen",this._handleScrollOnPopup,this);this._map.off("popupclose",this._handleScrollOnPopup,this);L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling")},_handleDragging:function(e){if(e.type=="movestart"||e.type=="move")draggingMap=true;else if(e.type=="moveend")draggingMap=
false},_disableInteractions:function(){this._map.dragging.disable();this._map.scrollWheelZoom.disable();if(this._map.tap)this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable();this._map.scrollWheelZoom.enable();if(this._map.tap)this._map.tap.enable()},_enableWarning:function(gesture){clearTimeout(this._isFading);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-"+gesture);L.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-warning")},_disableWarning:function(gesture,
delay){clearTimeout(this._isFading);this._isFading=setTimeout(L.bind(function(gesture){L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-"+gesture)},this,gesture),delay||this._map.options.gestureHandlingOptions.duration);L.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-warning")},_isLanguageContent:function(text){return text&&text.touch&&text.scroll&&text.scrollMac},_isMacUser:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},_parseGestureHandlingOptions:function(){var options=
L.extend(this._map.options.gestureHandlingOptions,gestureHandlingOptions);if(this._map.options.gestureHandlingText)options.text=this._map.options.gestureHandlingText;return options},_setGestureHandlingOptions:function(){var opts=this._parseGestureHandlingOptions();var content=this._isLanguageContent(opts.text)?opts.text:this._getLanguageContent(opts.locale);this._map._container.setAttribute("data-gesture-handling-touch-content",content.touch);this._map._container.setAttribute("data-gesture-handling-scroll-content",
content.scroll);this._touchWarning=content.touch;this._scrollWarning=content.scroll},_getUserLanguage:function(){return navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage},_getLanguageContent:function(lang){lang=lang||this._getUserLanguage()||"en";var content=LanguageContent[lang];content=!content&&lang.indexOf("-")!==-1?LanguageContent[lang.split("-")[0]]:content;content=content||LanguageContent["en"];content.scroll=this._isMacUser()?content.scrollMac:content.scroll;
return content},_hasClass:function(element,classList){for(var i=0;i<classList.length;i++)if(L.DomUtil.hasClass(element,classList[i]))return true;return false},_handleTouch:function(e){var ignore=this._hasClass(e.target,["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"]);if(ignore)if(L.DomUtil.hasClass(e.target,"leaflet-interactive")&&e.type==="touchmove"&&e.touches.length===
1)this._enableTouchWarning();else this._disableTouchWarning();else if(e.type!=="touchmove"&&e.type!=="touchstart")this._disableTouchWarning();else if(e.touches.length===1)this._enableTouchWarning();else{this._disableTouchWarning();this._enableInteractions()}},_enableTouchWarning:function(){this._enableWarning("touch");this._disableInteractions()},_disableTouchWarning:function(delay){clearTimeout(this._isTouching);this._isTouching=setTimeout(L.bind(function(){this._disableWarning("touch")},this),delay||
0)},_enableScrollWarning:function(){this._enableWarning("scroll");this._map.scrollWheelZoom.disable()},_disableScrollWarning:function(delay){clearTimeout(this._isScrolling);this._isScrolling=setTimeout(L.bind(function(){this._disableWarning("scroll");this._map.scrollWheelZoom.enable()},this),delay||0)},_handleScroll:function(e){if(e.metaKey||e.ctrlKey){e.preventDefault();this._disableScrollWarning()}else{this._enableScrollWarning();this._disableScrollWarning(this._map.options.gestureHandlingOptions.duration)}},
_handleScrollOnPopup:function(e){L.DomEvent[e.type=="popupopen"?"on":"off"](e.popup._contentNode,"wheel",this._handleScroll,this)},_handleMouseOver:function(e){this._enableInteractions()},_handleMouseOut:function(e){if(!draggingMap)this._disableInteractions()},_onExitFullscreen:function(){if(this._map.options.gestureHandling)this._map.gestureHandling.enable()},_onEnterFullscreen:function(){if(this._map.options.gestureHandling)this._map.gestureHandling.disable()}});L.Map.mergeOptions({gestureHandlingOptions:gestureHandlingOptions});
L.Map.addInitHook("addHandler","gestureHandling",GestureHandling);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc