Hello Martin, bratliff, Thank you much for that pointer - I was so sure that "this" would point to the listener function that I never explored the possibility of it actually being of any use - that is why I misunderstood bratliff's comment in the first place.
On Feb 6, 11:55 am, Martin Matysiak <[email protected]> wrote: > Great to hear that the SimpleMarker works :-) Regarding the serVisible > method: I did not know that markerclusterer needs it. But implementing a > working setVisible method isn't that hard. You could simply modify the css > "display" attribute of the single div layer. The only event directly > supported is the onclick listener, but adding others isn't very hard, too > (e.g. mouse over) - just add an eventListener to the div node and fire an > google.maps.event.trigger() when it occurs (the same way I did it with the > click listener). > > Regarding the singleton listener issue: in fact, the method _does_ know > which marker caused its execution! You can access the marker using the > "this" field. I added a "ID" attribute to my markers which you can easily > read out by calling this.getID(), but you can add any attribute to the > marker that you want. Here is an example (taken from my demo site for > SimpleMarker <http://demo.martin-matysiak.de/simplemarker/>): > > google.maps.event.addListener(marker, 'click', function() { > alert("Hello, SimpleMarker!\nMy bounds are: " + this.getBounds().toString() > + "\nIf you change the zoom, the bounds will, too!"); > > }); > > Eventhough the listener doesn't expect any parameters, it can access to the > caller and its properties by using "this.". -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
