Hello, I would like to active this option as well, but I think I make some mistakes, because I could not get it to work.
I have added the following to my function php
add_action('leaflet_map_loaded', 'fs_leaflet_loaded');
function fs_leaflet_loaded() {
wp_enqueue_script('gestures_leaflet', 'https://unpkg.com/[email protected]/dist/leaflet-gesture-handling.min.js', Array('wp_leaflet_map'), '1.0', true);
wp_enqueue_style('gestures_leaflet_styles', 'https://unpkg.com/[email protected]/dist/leaflet-gesture-handling.min.css');
// custom js
wp_enqueue_script('gestures', get_theme_file_uri( '/js/mapgesture.js' ), Array('wp_leaflet_map'), '1.0', true);
}
Created a folder “js” in the theme folder and added a js file “mapgesture.js”
inside this file I have put
(function() {
function main() {
if (!window.WPLeafletMapPlugin) {
console.log("no plugin found!");
return;
}
// iterate any of these: <code>maps</code>, <code>markers</code>, <code>markergroups</code>, <code>lines</code>, <code>circles</code>, <code>geojsons</code>
var maps = window.WPLeafletMapPlugin.maps;
for (var i = 0, len = maps.length; i < len; i++) {
var map = maps[i];
map.gestureHandling.enable();
});
}
}
window.addEventListener("load", main);
})();
It would be great if you could point me to the right solution.
Thank you!!!