tags:

views:

77

answers:

1

Hi all i have a Google map running on the v3 API, i added some custom markers, is it possible to make them scale depending on the zoom level of the map ? I tried searching the reference but cant seem to find any methods to resize a MarkerImage.

Maybe i have to remove markers everything the map changes zoom and create new markers in different size?

+1  A: 

Unfortunately, you would have to setIcon every single time. However, you can pre-define them, and then just apply them to the marker.

zoomIcons = [null, icon1, icon2];  // No such thing as zoom level 0. A global variable or define within object.
marker.setIcon(zoomIcons[map.getZoom()]);
CrazyEnigma
You can also hook this to a zoom_changed event, such as :google.maps.event.addListener(map, "zoom_changed", function() { var zoom = map.getZoom(); // do something depending on the current zoom });
Dr1Ku