here a little modification of the GoogleMap-Mod Renderer to automatically zoom to all shown markers depending on the Markergroup-selection in the ComboBoxes.
cnt.article.php:
Add the line
Code: Select all
map = map'.$crow["acontent_id"].';
Then modify the toggleGroup-Function to Reposition the Map at User-Selection:
Code: Select all
if ($content['googlemaps']['gmaps_showcat']) {
$output .= 'function Reposition(){
var MinX = 360;
var MinY = 360;
var MaxX = 0;
var MaxY = 0;
for(var i in markerGroups137)
{
for(var j = 0; j < markerGroups137[i].length; j++)
{
var marker = markerGroups137[i][j];
if(marker.isHidden())
{
}
else
{
var l = marker.getLatLng();
if (l.lat() < MinX)MinX = l.lat();
if (l.lat() > MaxX)MaxX = l.lat();
if (l.lng() < MinY)MinY = l.lng();
if (l.lng() > MaxY)MaxY = l.lng();
}
}
}
if(MinX < 360)
{
var sw = new google.maps.LatLng(MinX,MinY);
var ne = new google.maps.LatLng(MaxX,MaxY);
var bounds = new google.maps.LatLngBounds(sw,ne);
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
}
}
';
$output .= 'function toggleGroup'.$crow["acontent_id"].'(type) {
for (var i = 0; i < markerGroups'.$crow["acontent_id"].'[type].length; i++) {
var marker = markerGroups'.$crow["acontent_id"].'[type][i];
if (marker.isHidden()) {
marker.show();
} else {
marker.hide();
}
}
Reposition();
}
';
}
![Wink ;-)](./images/smilies/icon_wink.gif)
(Example of this AutoZoom: http://www.janina-arpa.de/AnfahrtVHS.phtml)
Best regards,
Bjoern