Coder Social home page Coder Social logo

Comments (10)

ebidel avatar ebidel commented on April 29, 2024

Surprised I never ran into this!I can repo it on http://googlewebcomponents.github.io/google-sheets/components/google-sheets/demo.html.

The intention is that the user can still drag the map. Looks like this is from https://github.com/GoogleWebComponents/google-map/blob/master/google-map.html#L668:L669. The lat/lng get updated and updateCenter() gets called as a result. This calls showCenterMarkerChanged() explicitly which does the fitToMakers stuff. There was a good reason for that call but I can't recall off the top of my head.

Interested in submitting a PR?

from google-map.

levitanong avatar levitanong commented on April 29, 2024

Alright, I've made a PR! It's a simple fix, and it partially solves the issue. It will still explode if showCenterMarker is true, but that's a separate discussion on what you want the behavior to be.

The two are mutually exclusive I think. I mean, you have a marker that's supposed to stay in the center of your map all the time, and if you have other markers on the map that will change the map center position, then you'll get some pretty weird stuff.

I have three recommendations off the top of my head:

  1. We can make it so that one overrides the other, and mention it in the documentation. e.g. "fitToMarkers will override showCenterMarker, whenever it's set to true." In which case a true value in one will automatically turn the other false.
  2. Throw an error if the two mutually exclusive cases are set to true, and again, mention it in the documentation.
  3. Do not include the centerMarker in calculations for fitToMarkers. This may sound good and correct, but it's a special case may complicate things, and we may get more weird edge cases from this.

from google-map.

aidanlister avatar aidanlister commented on April 29, 2024

+1

from google-map.

eximius313 avatar eximius313 commented on April 29, 2024

I'm also experiencing the same issue!
map shakes and doesn't allow to drag it (even when zoomed in)

from google-map.

rbrewer101 avatar rbrewer101 commented on April 29, 2024

Me too.
Any estimate of if/when this little weirdness might be resolved?
I'm not quite up to the task of fixing it myself, but offer gratitude to anyone who does get it resolved.

from google-map.

levitanong avatar levitanong commented on April 29, 2024

To quickly fix this, have a look at google-map.html. There'll be this.updateMarkers();. Wrap it in a conditional hinged on the existence of centerMarker.

if (this.centerMarker) {
  this.updateMarkers();
}

from google-map.

ebidel avatar ebidel commented on April 29, 2024

@levitanong I merged your PR. Thanks! I think your #3 makes sense. It may confuse users if the center marker is treated differently, but it's always been more of a convenience than anything else. It also existed before we had proper marker support, so maybe it's time to actually remove it.

from google-map.

levitanong avatar levitanong commented on April 29, 2024

Hurrah!

from google-map.

eximius313 avatar eximius313 commented on April 29, 2024

I'd say that #2 is more verbose than #1 (fail fast) and we don't introduce additional complexity as in #3

from google-map.

rbrewer101 avatar rbrewer101 commented on April 29, 2024

Works! Thanks very much @levitanong and @ebidel.

from google-map.

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.