Developer forum

Forum » Rapido » Set Google Maps zoom rate

Set Google Maps zoom rate

Axel Marijt
Axel Marijt
Reply

Hi,

We've got on multiple Rapido site's a Google Maps map. Some of these only have one pointer to show, for example the location of the office.

When one location is showed the zoom of the Map is very high, as you can see in the link. Is it possible to change the zoom-level of the map?

http://partell2.azurewebsites.net/partell-maakt-telefoon-en-internet-weer-simpel/contact

 


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Axel

Yes, in /templates/Designs/Rapido/js/Maps.js locate the line that says "map.setZoom(10);" Play around with the number and see what fits. You may need to clear the browser cache to see the change.

 

Best regards
Karsten Thuen

 
Axel Marijt
Axel Marijt
Reply

Ha Karsten,

I've tried that, but so far it doesn't work... perhaps i'm doing something wrong. 

Little sidenote, my Maps.js file is located in /templates/Designs/Rapido/js/source/Maps.js, hope thats ok.

We're running DW 9.4.10 and the latest Rapido.

 

Grt. Axel

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Axel

Oh, Google Maps was not that easy finetune. What I found now is that you should remove "boundListener", and then instead, right after "map.fitBounds(bounds);" add this:

var listener = google.maps.event.addListener(map, "idle", function () {
     map.setZoom(2);
     google.maps.event.removeListener(listener);
});

You can read this for more info: https://stackoverflow.com/questions/2437683/google-maps-api-v3-can-i-setzoom-after-fitbounds

 

Best regards
Karsten Thuen

 
Gaëtan Di Caro
Reply

Hi Karsten,

 

I'm having the same issue, but nothing happens when I modify the Maps.js file. It seems that the content of all js files is copied at some point into master.js, which is then minified. How do I make that happen ? I couldn't find any info anywhere.

 
Nicolai Pedersen
Reply

HI Gaƫtan

You have to compile the new min.js file again using VS or whatever tool you are using. We use web essentials plugin to do so...

BR Nicolai

 
Gaëtan Di Caro
Reply

Oh alright, I had the impression that Rapido would take care of the bundling and minifying by itself. That's too bad, it makes it more difficult to edit stuff, as well as requiring some tools instead of just editing the js file.

What files are bundled in the master.js ? The entirety of the source folder ?

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi

Yes, on Ecommerce sites everything is included. If you use Visual Studio, you can use this: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier

I have attached our configuration file. You can finetune it as much as you like. It should be put in the root of the site. 

 

Best regards
Karsten Thuen

 
Gaëtan Di Caro
Reply

I see, thanks, that file is a great help.

 

You must be logged in to post in the forum