Matt-Jensen / ember-cli-g-maps

Deprecated Google Maps Addon
http://matt-jensen.github.io/ember-cli-g-maps
MIT License
59 stars 31 forks source link

How can I center the markers on the map? #67

Closed memoxmrdl closed 7 years ago

memoxmrdl commented 7 years ago

I have a problem how can I auto-center the markers on the map?

Matt-Jensen commented 7 years ago

Well there's more than one way. The most straightforward way I can think of is using the center_changed event of the g-maps component and applying the map center to the marker in question. Would that work for you?

memoxmrdl commented 7 years ago

Hi Matt, yep I'm try use 'center_changed' but I have many centers that can't centering above on the map, I need something as following:

map.setCenter(new google.maps.LatLng(latitude, longitude));

Matt-Jensen commented 7 years ago

Just so I understand your issue correctly, you have a group of markers that need to be updated to the new center of the map once the user has changed the center of the map?

I'm afraid I'm not sure what you mean by:

I have many centers that can't centering above on the map

However the map.setCenter(...) code you have can be easily achieved with: set(this, 'myMapLat', newLat) and set(this, 'myMapLng', newLng)

where:

{{g-maps lat=myMapLat lng=myMapLng}}

memoxmrdl commented 7 years ago

Yep! sorry for my English, I understand your solution let me try again. thanks