Reputation: 293
from today I've been experiencing an issue with Google Maps resulting into not centering maps when I add some IndoBoxes into map.
I have a few InfoBoxes as follows:
var labels = [
new InfoBox({
content: "Old Town (Stare Mesto)",
position: new google.maps.LatLng(50.088979, 14.414921),
boxStyle: {
border: "2px solid white",
textAlign: "center",
color: "white",
fontSize: "8pt",
fontWeight: "bold",
width: "200px",
height: "17px",
background: "black",
opacity: 0.5,
filter: "alpha(opacity=50)"
}
}),
new InfoBox({
content: "New Town (Nove mesto)",
position: new google.maps.LatLng(50.084243, 14.424405),
boxStyle: {
border: "2px solid white",
textAlign: "center",
color: "white",
fontSize: "8pt",
fontWeight: "bold",
width: "200px",
height: "17px",
background: "black",
opacity: 0.5,
filter: "alpha(opacity=50)"
}
})
];
If I add them on map
for (var i in labels) {
labels[i].open(map);
}
Then map viewport is moved to these labels. Even If I call map.setCenter(someLatLngObject) center is stucked on those InfoBoxes.
Is that behavior expected?
Upvotes: 2
Views: 1096
Reputation: 3794
Have you tried the disableAutoPan option?
new InfoBox({
disableAutoPan: true,
content: "New Town (Nove mesto)",
position: new google.maps.LatLng(50.084243, 14.424405),
Upvotes: 2