Comments (5)
Thank you. I am aware of this issue but haven't had the time to fix it. Generally, you need to pass options for locate
as locateOptions
.
So, you would need to write
map.addControl(L.control.locate({
setView: true,
locateOptions: {
maxZoom: 10
}}));
However, the way moving the map is implemented, maxZoom
is not implemented. The problem is that I had to implement the whole code that sets the view myself because I wanted to be able to not set the view in some cases (we can already see the marker...). You would need to add this and I'd be happy to review the pull request.
from leaflet-locatecontrol.
Is there any workaround to this? I'd really like to be able to make a map with geolocation that doesn't automatically zoom ALL the way in.
from leaflet-locatecontrol.
Someone would need to look into the leaflet implementation and see whether there is a way to use a maxZoom setting. At the moment, I am using http://leafletjs.com/reference.html#rectangle-setbounds to zoom/pan and it does not take a maxZoom option.
One thing you can do is increasing the padding but that is certainly not the best way to do it. You could hack the code to use a padding that is higher if you are zoomed in further. But that is very hacky. Better, as said earlier, would be to look into the code and see whether there is a clean way to set the bounds with a maxZoom option but I don't have the time for this right now, sorry.
from leaflet-locatecontrol.
Actually I incorporated the changes in the code linked above my comment and it works fine for me.
from leaflet-locatecontrol.
No, it doesn't. It always uses the maximum zoom level even if it is too high. The variable should be called zoomLevel
.
from leaflet-locatecontrol.
Related Issues (20)
- How can I put compass on the specified location on map HOT 1
- stopFollowing method throws error
- `role="button"` on the control HOT 2
- Icon in dark mode HOT 3
- GPS Altitude HOT 1
- Warning: "listener not found" for leaflet 1.8.0 HOT 1
- ES module support? HOT 1
- flyTo and untilPanOrZoom combination breaks following
- markerClass and LocationMarker HOT 1
- Dropping Mapbox.js support? HOT 2
- calling stopLocate on null
- locateOptions (eg: keepCurrentZoomLevel) Not Working
- Compass displayed even when needing calibration HOT 1
- Not finding location in Chrome & Firefox for Mobile HOT 5
- Display lat, lng, alt in the inner marker popup
- CSS missing if installing with npm HOT 6
- Custom icons no longer support color status indicators
- Request: Add speed and track information HOT 1
- [QUESTION] : displays the latitude & longitude values and drags the marker after the location is found HOT 1
- Use iconElementTag with other options than CSS class HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet-locatecontrol.