Skip to content

Commit

Permalink
Fix showCenterMarker when the map isn't defined with a center.
Browse files Browse the repository at this point in the history
panTo() doesn't set the center immediately which results in:
1. showCenterMarker not knowing where the center is.
2. fitToMarkers setCenter is overridden by the panTo completion.
  • Loading branch information
bamnet committed Jul 31, 2014
1 parent f5b381f commit 5cd218c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions google-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,14 @@
typeof this.longitude === 'object') {
return;
}
this.map.panTo(
new google.maps.LatLng(this.latitude, this.longitude));
var center = new google.maps.LatLng(this.latitude, this.longitude);
if (!this.map.getCenter()) {
// If the map does not have a center, set it right away.
this.map.setCenter(center);
} else {
// If the map currently has a center, slowly pan to the new one.
this.map.panTo(center);
}
this.showCenterMarkerChanged();
},

Expand Down

0 comments on commit 5cd218c

Please sign in to comment.