9

I've got a Google Map with some controls in the bottom right corner (the other 3 corners are already occupied, so these all need to be in the same corner). I set it up like so:

mapTypeControlOptions: {
    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE],
    position: google.maps.ControlPosition.RIGHT_BOTTOM
},
zoomControlOptions: {
    style: google.maps.ZoomControlStyle.SMALL,
    position: google.maps.ControlPosition.RIGHT_BOTTOM
},
streetViewControlOptions: {
    position: google.maps.ControlPosition.RIGHT_BOTTOM
}

This produces the following result:

...that looks silly, so I tried switching the mapTypeControl to the BOTTOM_RIGHT position:

Ideally, this is what I'd like (the same as the first, but with the mapTypeControl at the bottom):

I've dug through the API docs, and while it looks like there's a way to control the order of custom controls, I don't see a way to re-arrange native ones. Can this be done? If it's not possible to do it quite like my last example, is there at least a better way to arrange the controls so none of them stick out like a sore thumb?

1 Answer 1

0

According to the ControlPosition docs Controls that are added first are positioned closer to the edge of the map.

And for the RIGHT-BOTTOM position Elements are positioned on the right, above bottom-right elements, and flow upwards..

However that seems to contradict what seems to be happening with yours. As you're just applying all the controls as part of the MapOptions specification, I wonder if they just mean this applies when adding custom controls, as the other part of the developer guides mention (as you already said).

Perhaps you could create your own custom controls that are really just an extension of the StreetView / MapType / Zoom controls? However they don't look like you could just instantiate an instance of any of those controls... what do you get if you do console.log(map.controls)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.