bjorn2404 / jQuery-Store-Locator-Plugin

A store locator plugin using Google Maps API version 3
MIT License
493 stars 235 forks source link

Better way to set zoom level after doing a search? callbackFormVals: { `setTimeout(() => { this.map.setZoom(1); }, 50); #250

Open mvaneijgen opened 5 years ago

mvaneijgen commented 5 years ago

When A visitor searches on a location I want to set the zoom level of the Google Maps based on the distance (bh-sl-maxdistance) they set, so on the callbackFormVals I want to set this.map.setZoom(CUSTOM_NUMBER);, but it seems that also sets the zoom level at the same time. The only way I could think to fix it (and this works) setTimeout(() => { this.map.setZoom(1); }, 50);, but this seems a bit hack-y and was looking for a better way to set the zoom level after the form is submitted.