Thursday, November 26, 2009

v3 markers and info windows

v3 constructors like Marker(opts) and InfoWindow(opts) take an options object as their single parameter.

How about composing a createMarker(opts) function that also takes a single options object and creates both Marker and Infowindow.

Marker and InfoWindow options have 'position' and 'zIndex' properties in common. All the other property names are unique.

You have to give 'position' for a Marker. Giving the same position to InfoWindow has no effect if is given an anchor.

There is no need to set zIndex of InfoWindow if you are using just a single instance of InfoWindow. It even doesn't have any visible effect. So we can freely use zIndex to control the marker.

There was no need to convert any property names. makeMarker(opts) function can be seen in action here.

The single options object can further be extended to include new properties like 'category' and 'sidebarLabel'.