Reputation: 23466
I need to exclude one zoomlevel. Therefore I need to capture the zoom event, check if I'm going out or in and forward the map to the next legit zoom level.
It seems that the zoomstart
event isn't working anymore... Any ideas?
Upvotes: 0
Views: 1326
Reputation: 23466
If found a workaround... The trick is to use a global variable. In this case I want to exclude MIN_ZOOM_LEVEL+1
.
var last_zoom_level;
google.maps.event.addListener(map, 'zoom_changed', function() {
if(map.zoom == MIN_ZOOM_LEVEL+1) {
if(last_zoom_level == MIN_ZOOM_LEVEL)
map.setZoom(MIN_ZOOM_LEVEL+2);
else if(last_zoom_level >= MIN_ZOOM_LEVEL+2)
map.setZoom(MIN_ZOOM_LEVEL);
}
last_zoom_level = map.getZoom(); }
Upvotes: 1