prikha
prikha

Reputation: 1853

How to customize map controls using Gmaps4rails gem?

i've got confused trying to change the map controls like said here But don`t know how to implement using gmaps4rails gem.

I just wanted to leave only zoom and pan control and remove all the others. But js console says for:

 >> Gmaps.map.map.mapTypeControl
 >> false

But it is still present on a map.

Upvotes: 0

Views: 1379

Answers (2)

Benjamin Crouzier
Benjamin Crouzier

Reputation: 41925

If you are initialising with javascript (not with <%= gmaps %>), use

Gmaps.search_map.map_options.raw.streetViewControl = false;

More options here

Upvotes: 0

apneadiving
apneadiving

Reputation: 115541

You can use a raw parameter to send any map option you need. See doc.

I guess, you should do:

<%= gmaps(:map_options => { :raw => '{ panControl: true,
                                       zoomControl: true,
                                       mapTypeControl: false,
                                       scaleControl: false,
                                       streetViewControl: false,
                                       overviewMapControl: false}' 
                          },
          :markers => { :data => @json  } 
)%> 

Upvotes: 11

Related Questions