Friday, December 10, 2010

v3 Marker z-index, the way I thought it was

The way it is

Marker.getZindex() returns 'undefined' if you did not set any value for it. Looking under the hood reveals that actually there is a latitude dependent value set for the marker DOM element. The value seems to be equal to 'top' position of the marker in map container. That is clever. It takes care that markers are displayed in right order by latitude (South on front). But why is the value not returned?

Set any value for Marker z-index. Now getZIndex() returns the value and that set for the Marker DOM element. So setting a z-index value of your own ruins the order set by API.

The way it might be

User z-index and actual DOM z-index should be separated.

Markers should have the default DOM z-index as it is now.

Marker.getZindex() should return zero if you did not set any z-index.

Setting a z-index value would be added to the default value.

So user z-index would be relative to the actual DOM value.

API would take care of order by latitude (of overlays with equal z-index) like it currently does without any z-index settings.


That would make the zIndex property of Marker, Circle, InfoWindow etc much easier to use. Currently you have to rewrite all the z-index values if you want to raise z-index of a single marker..

I have a feeling that it was originally meant to work that way.

1 comment:

Anjum Rizwi said...

I have a map with Marker, poly line.
It works on my page.
But when I make it as jquery dialog, than It shows map without zoom control, marker and poly line.
I am using jQuery 1.6.1.

Your any help and suggestion will be highly appreciated.