Note that there are some explanatory texts on larger screens.

plurals
  1. POChange order of Google Map controls in the same location (i.e. RIGHT_TOP)
    text
    copied!<p>I need to rearrange the default controls in the Google Map (v3, 3.4) API.</p> <p>Everything is in place and works, but when I add the <em>mapTypeControl</em>, <em>zoomControl</em>, the <em>streetViewControl</em> and the <em>panControl</em> to the same <em>ControlPosition</em> (i.e. google.maps.ControlPosition.RIGHT_TOP), I can't define the order of how they are rendered. </p> <p><em>mapTypeControl</em> has a default of TOP_RIGHT, but changing it to RIGHT_TOP (the default of the other ones mentioned above) add's it to the bottom in this location:</p> <p><img src="https://i.stack.imgur.com/NXl4Z.png" alt="google maps controls"></p> <p>Here's the code for the map options (nevermind the added OSM layer):</p> <pre><code>var mapOptions = { zoom: 12, center: def_center, // is set before this snippet mapTypeControl: true, mapTypeId: user_maptype, // is set before this snippet mapTypeControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.TERRAIN, "openstreetmap"] }, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.DEFAULT, position: google.maps.ControlPosition.RIGHT_TOP }, streetViewControl: true, streetViewControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP }, panControl: false, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP }, scaleControl: false, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_RIGHT } }; </code></pre> <p>I need the <em>mapTypeControl</em> to be the first element to be rendered (above the streetViewControl). Any idea how to do this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload