Coder Social home page Coder Social logo

Comments (7)

bestguy avatar bestguy commented on April 28, 2024

Note I do not want a marker - I want the current map center

from google-map.

robdodson avatar robdodson commented on April 28, 2024

Can you grab them from the map?

document.querySelector('google-map').map.getCenter()

from google-map.

bestguy avatar bestguy commented on April 28, 2024

Thanks, partly, though how do I know when they have changed?

from google-map.

ebidel avatar ebidel commented on April 28, 2024

You should be able to access map.latitude and map.longitude to get the current points. Likewise for zoom.

var mapEl =  document.querySelector('google-map');
console.log(mapEl.latitude, mapEl.longitude);

We haven't exposed an event for when the center changes, but you can get at it two ways:

  1. data binding to the latitude/longitude attribute of the map element.

  2. add a listerner directly on the maps api object:

    google.maps.event.addListener(mapEl.map, 'center_changed', function() {...});
    

from google-map.

bestguy avatar bestguy commented on April 28, 2024

Thanks, is this by design, or would you be open to a pull request to add this?

from google-map.

ebidel avatar ebidel commented on April 28, 2024

It's one of those things that's fairly easily to setup without the element adding additional features. This is one reason we expose the maps api object on the element. People can do whatever they want with it and we don't need to cover 100% of the API feature set. That said, and updated center is fairly common and a 1 line addition. PR welcome :)

from google-map.

bestguy avatar bestguy commented on April 28, 2024

Thanks, will do

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.