Release 2.4.0
Version 2.4.0 adds an option to prevent the default map scroll/touch behaviours to make it easier for users to navigate in a page (pretty much like in Google Maps).
The option is deactivated by default, to keep the default Leaflet.js functionality, and avoid loading an additional script. You might want to activate it, though, as it prevents users from getting trapped on the map when scrolling a long page.
The new feature utilizes leaflet-gesture-handling. It will auto detect a user's language from the browser setting and show the appropriate translation.
However if you wish to override this, you can set your own text, using the ootb_gesture_handling_options
filter as shown below (you must specify text for touch
, scroll
and scrollMac
):
add_filter(
'ootb_gesture_handling_options',
function () {
return [
'text' => [
'touch' => 'Hey there, use two fingers to move the map',
'scroll' => 'Hey there, use ctrl + scroll to zoom the map',
'scrollMac' => 'Hey there, use \u2318 + scroll to zoom the map',
],
'locale' => 'en', // set language of the warning message.
'duration' => 5000, // set time in ms before the message should disappear.
];
}
);
(you should paste the above in your theme's functions.php
)