bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 142 forks source link

Limit Zoom In #298

Closed jomayan closed 4 years ago

jomayan commented 6 years ago

Is there a way to limit the maximum Zoom In?

bradcornford commented 6 years ago

Yes, this would be possible, something like the below should work:

Mapper::map(53.381128999999990000, -1.470085000000040000, ['eventAfterLoad' => 'limitZoom(map);']);
function limitZoom(map) {
map.event.addListener(map, 'zoom_changed', function() {
     minZoomLevel = 1
     if (map.getZoom() < minZoomLevel) map.setZoom(minZoomLevel);
   });
}
jomayan commented 6 years ago

Thanks Brad. Will try this out.

Johnny1210 commented 6 years ago

hello there,

I'm having a different issue with zoom in and out key....

Sometimes the key does exists sometimes not, I don't even know why this is happing...

image

image

Can you help me to show the switch

Thanks