Code Monkey home page Code Monkey logo

Comments (3)

jlariza avatar jlariza commented on July 18, 2024

I found the problem.

At /mapwidgets/static/mapwidgets/js/mw_google_point_field.js line 62 the function "fitBoundMarker" is defined. For some reason, before the function, this.zoom is equals to the value I set in the settings but inside the function this.zoom is always equals to 21. This produce that the following conditional at line 67 is always true,
if (this.getZoom() > 15) { this.setZoom(15) }
setting the map zoom as 15 always, no matter what your original zoom setting was. I fixed it commenting the fitBoundMarker function (the map disappears if the conditional gets commented) ; but I am not sure if it is important and what it is doing. I hope that with this information you are able to fix the error. I think that the zoom checking could be done from python and fix/remove the fitBoundMarker function if it is solely checking bad zoom configurations.

from django-map-widgets.

erdem avatar erdem commented on July 18, 2024

Hi Jlariza

I implemented that logic because of when I used fitBounds method on google map javascript API for a single marker, the map zoom value is getting maximum. This is not helping for end users when they are searching specific address. Check the screenshot.

ss

As you can see Victoria station doesn't appear on the map at the maximum zoom value. It can be seen decrease the zoom level. The maximum zoom value is not useful for single marker viewing. This is the best solution I found for this user experience issue.

I think, that zoom logic must be optional. I will add a settings value for the logic.

Of course, we can discuss other solutions for this issue.

Thanks.

from django-map-widgets.

erdem avatar erdem commented on July 18, 2024

@jlariza FYI,

I implemented the new config option for this issue in new version. You can set "markerFitZoom" value on your MAP_WIDGETS settings.

Check out the new documentation for more detail.

http://django-map-widgets.readthedocs.io/en/latest/widgets/point_field_map_widgets.html#settings

Thanks

from django-map-widgets.

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.