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 InfoWindow.open() 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'.

5 comments:

Mario said...

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

can you provide an example soon?
exactly what im looking for!

Esa said...

I will publish basic sidebar in 20 hours.

Category has some questions that need discussion. Are the following features needed:
- subgategories
- one marker belonging to several categories

Mario said...

wont need subcategories and marker for more than 1 category though

Unknown said...

I can't get zIndex to work on an InfoWindow at all :(

Marcus said...

@Mark Ashwork, Old post but maybe someone else googles upon it as I did...

infoWindow.setZIndex(99999); does work for changing zIndex when using multiple info windows.