Jump to content
TNG Community
Sign in to follow this  

Google Map: No auto zoom-in possible?

Recommended Posts


Ken and All,


It's more than 3am now but I've found a solution. Check the map - close it - open it: It's zoomed out 8)


However: If you zoom (+/-) and then Close/Open in a new level, it's back to the first level.

Also: After Close/Open, the first click on +/- doesn't work. The next does.


The solution is also compatible with the original TNG maps - I have uninstalled the mod here:

This one keeps the default zoom level and doesn't zoom in although it can:



This one is zoomed out as it should be:



The change I made is in googlemaplib.php, see the remarks:

        if($markerNum > 1) {
            echo "   map.fitBounds(bounds);\n";

            // This line is new
            echo "   if (map.getZoom() > $zoom) { map.setZoom($zoom); }\n";

            // 'bounds_changed' is replaced by 'zoom_changed' here - will be this in TNG v12.0
            echo "   google.maps.event.addListenerOnce(map, 'zoom_changed', function(event) {\n";

            echo "       if (map.getZoom() > $zoom) {\n";
            echo "           map.setZoom($zoom);\n";
            echo "       }\n";
            echo "   });\n";

That's it.

I don't really know but it seems like that new line "forces" the zoom_changed to signal...


I will write to Darrin tomorrow. Have to sleep now :-D


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this