domoritz / leaflet-locatecontrol

A leaflet control to geolocate the user.
https://domoritz.github.io/leaflet-locatecontrol/demo/
MIT License
812 stars 264 forks source link

locateOptions (eg: keepCurrentZoomLevel) Not Working #331

Open c0nsumer opened 1 year ago

c0nsumer commented 1 year ago

I am using Leaflet v1.9.3 with the latest version of leaflet-locatecontrol as of 2023-Jan-15.

The issue I am running into is that setting locateOptions doesn't seem to work. For example, I am doing this:

// Add a geolocation control
        L.control.locate({
            strings: {
                title: "Show my location",
                outsideMapBoundsMsg: "Your location is outside the RAMBA area.",
            },
            locateOptions: {
                flyTo: true,
                enableHighAccuracy: true,
                keepCurrentZoomLevel: true,
                initialZoomLevel: false,
                showPopup: false,
                setView: false,
                metric: false,
            },
        }).addTo(trailmap);

However, things like showPopup and keepCurrentZoomLevel aren't being used.

If I use L.Control.Locate.js (not the minified version) and set them directly (lines 179 and 323) in here, then they work fine.