angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

ui-gmap-map-control does not support negative index override of core controls' flow primacy

Open rummelsworth opened this issue 12 years ago • 7 comments

From the ui-gmap-map-control directive's API page for the index parameter:

Index applied to the map control. Controls are placed at each location by the order of the index; controls with a lower index are placed first.

By default, all custom controls are placed after any API default controls but this can be overridden using a negative index. Custom contols cannot be placed to the left of the logo or the right of the copyrights.

This doesn't seem to be the case, though. Even in the example provided for the directive, the index parameter is set to "-1" without any apparent effect. In other words, the custom control is not to the right of the MapTypeControl.

If you edit position in the plunk to "top-left", it also doesn't place the custom control to the left of the PanControl or the ZoomControl. (Tangentially, both of those default to TOP_LEFT according to the Maps JS API v3 reference page, which seems to mean the ZoomControl should flow to the middle, not downward as it does normally... I'd look into this more, but it seems one can't retrieve the actual default options from google.maps.Map. The positioning docs talk a bit about how the positioning code tries to intelligently lay things out, so maybe there's something going on in that respect.)

Anyway, back on topic: Google's docs clearly state exactly what ui-gmap-map-control's docs state about this...

Here's a fiddle based on one of Google's custom control examples where I've set the custom control's index property to -1. It works as expected.

So it seems like a bug in ui-gmap-map-control's handling of its index parameter.

rummelsworth avatar Nov 19 '14 18:11 rummelsworth

I've noticed the same behavior, with the additional note that the index value seems to have no effect at all. The controls are laid out in the sequence they appear within the ui-gmap-google-map directive, regardless of index values set.

garkbit avatar Nov 26 '14 20:11 garkbit

That directive is not that complicated feel free to make the necessary improvements.

nmccready avatar Nov 26 '14 21:11 nmccready

Also there was a map-layer directive added. You could make map-control a child of that.

nmccready avatar Dec 04 '14 18:12 nmccready

Hi nmccready, I am facing the same issue. It would be nice if you could fix this.

owahlen avatar Dec 06 '14 15:12 owahlen

Not a priority on my list right now. If it is for others or yourself. I suggest you to dig in and help out/ give back.

nmccready avatar Dec 06 '14 17:12 nmccready

Fixing this issue seems to be pretty easy. I have created a pull request for you: https://github.com/angular-ui/angular-google-maps/pull/983 Please have a close look. I am not an expert in coffee script. Since the functionality is very important for us it would be nice if you could incorporate the fix into the next version.

owahlen avatar Dec 06 '14 22:12 owahlen

Ty

nmccready avatar Dec 07 '14 15:12 nmccready