Giter VIP home page Giter VIP logo

Comments (5)

domoritz avatar domoritz commented on May 23, 2024

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.

thecristen avatar thecristen commented on May 23, 2024

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.

domoritz avatar domoritz commented on May 23, 2024

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.

thecristen avatar thecristen commented on May 23, 2024

Actually I incorporated the changes in the code linked above my comment and it works fine for me.

from leaflet-locatecontrol.

domoritz avatar domoritz commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.