google.maps.event.addListener(google_map, 'zoom_changed', function() { var z = google_map.getZoom(); _.each(map_shapes, function(s) { if (! $.isFunction(s.shape.getPosition)) return; var w = s.shape.getIcon().size.width; var h = s.shape.getIcon().size.height; s.shape.setIcon(new google.maps.MarkerImage( s.shape.getIcon().url, null, null, null, new google.maps.Size( w - Math.round(w / 3 * (last_zoom - z)), h - Math.round(h / 3 * (last_zoom - z))) ) ); }); last_zoom = z; });
I use this code to resize my marker when someone zooms in or out, but it zooms in on the zoom out and zooms out on the zoom. I want it to be the other way around.
I am using the Google Maps API 3.
I tried several different combinations, but I can not get it to work.
source share