mcguffin / acf-openstreetmap-field

WordPress ACF Field for OpenStreetMap
https://wordpress.org/plugins/acf-openstreetmap-field/
GNU General Public License v3.0
107 stars 21 forks source link

Set scrollWheelZoom #37

Closed SRUC closed 4 years ago

SRUC commented 4 years ago

Is it possible to set the scrollWheelZoom property via the map created event in to allow the map to be zoomed using a mousewheel? If so, how? I have tried this without success:

(function($){
    $(document).on('acf-osm-map-created',function(e,map){
        // do something with map 
        // @see https://leafletjs.com/reference-1.3.2.html#map-setzoom
        map.scrollWheelZoom(true)
    });
})(jQuery)

Thanks, David

mcguffin commented 4 years ago

Hi, i'm afraid its not yet possible. But I'll add it to the todo list.

mcguffin commented 4 years ago

As of version 1.1.8 this one will do it:

(function($){
    $(document).on('acf-osm-map-create',function(e){
        e.originalEvent.data.scrollWheelZoom = true;
    });
})(jQuery)