I'm having trouble with my function that takes the zoom level and sets the center of the map. When I call setCenter with my positional coordinates and zoom level, the map doesn't zoom in where I want it to. However, the position of my info window is correct. This is the function I am using:
function moveToLocation (longitude, latitude, zoom, isDefault) {
var position = new google.maps.LatLng(latitude, longitude);
window.refPointMarker.setPosition(position);
var info;
if (isDefault == true) {
info = "<p style='font-weight:bold; font-size:12;'>Default reference point.</p>";
info += "<p style='font-size:12;'> Click on the map to select a new location. </p>";
}
else {
info = "<p style='font-weight:bold; font-size:12;'>Current reference point.</p>";
info += "<p style='font-size:12;'> Click on the map to select a new location. </p>";
}
if (window.infoWindow) window.infoWindow.close();
window.infoWindow = new google.maps.InfoWindow({
content: info,
position: position,
anchor: window.refPointMarker
});
window.map.setCenter(position, zoom);
}
Can anyone help me figure out what I might be doing wrong here?