On Dec 14, 5:26 pm, Silver <silv...@gmail.com> wrote: > Hi Marcelo, > Thanks a lot. > Please... check the follow example:
I don't parse code in my head as the compiler in my browser is much better at doing that. > > In this case... I'm creating 2,000 markers in the loop, but I don't > need create 2,000 listeners because I'm receiving in the map the > triggered events. > Am I wrong? This way improve the memory availability? > Regards!! Your original question was about 3000 "complex" polygons, not about markers. -- Marcelo - http://maps.forum.nu -- > > On 14 dic, 15:13, Marcelo <marcelo...@hotmail.com> wrote: > > > > > > > > > Polygons are not DOM objects, therefore you cannot make use of the > > javascript properties event bubbling and target that are used with the > > event delegation technique. > > According to the documentation, the map pane that holds the polygons, > > (overlayLayer), may not receive DOM events, so in terms of map > > objects, the parent which could do event delegation is the map itself. > > In order to do this you'd need to iterate an array of polygons and do > > some point-in-polygon analysis to determine in which polygon the event > > took place. This might work with click events, but I can't imagine it > > performing all too well with mouseover or mouseut events, which would > > have to be triggered by a mousemove event handler on the map. > > > In more general terms, mouseover and mouseout on as many as 3000 > > objects is nuts! (IMHO) :-) > > > -- > > Marcelo -http://maps.forum.nu > > -- > > > On Dec 14, 1:46 pm, Silver <silv...@gmail.com> wrote: > > > > Hello friends, > > > Some idea about events delegation instead events handling in Google > > > Mapas API v3?? > > > Currently, I'm creating 3,000 complex polygons, each of them has 5 > > > listeners (click, dblclick, mouseover, mouseout and rightclick)... > > > with a hight use of memory. > > > A better approach can be using OverlayView extending a polygon class, > > > setting the listeners only one time and trigger its to the map?? > > > Some example or idea?? > > > Thanks a lot, > > > Silver -- 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 google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.