Thanks. I'd ideally like to see the Map click event behave as it did in v2 of the API.
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GMap2.click So a click on an Overlay triggers both a Map and and an Overlay click event. I've seen posts on this group requesting the same - generally to enable some sort of event delegation when dealing with lots of Markers. Think about DOM event listeners - you can listen for a click event on an element and also any element that it contains. Much more flexible then just a single element being able to generate an event. Martin. On Oct 17, 4:25 pm, Chris Broadfoot <[email protected]> wrote: > Hi Martin, > > This does indeed look like a bug. The only point of contention is whether > the bug lies with optimized markers, or unoptimized markers. In reality, > "clickable" (default true) means that the overlay (marker, polygon, > polyline) captures all mouse events. > > I'll raise this issue with the team. > > Thanks, > Chris > > --http://twitter.com/broady > > > > > > > > On Sun, Oct 16, 2011 at 5:25 PM, Martin™ <[email protected]> wrote: > > Hi All. > > > I've started a new thread for this subject - it follows on from this > > recent thread about MarkerImage and optimised Markers: > > >https://groups.google.com/group/google-maps-js-api-v3/browse_frm/thre... > > > I've run into a problem with optimised Markers and the Map mousemove > > event... > > > Here's a project i've been working on: > > >http://developer.martinpearman.co.uk/markers_event_layer/demo/index.htm > > > and > > >http://developer.martinpearman.co.uk/markers_event_layer/demo/index.h... > > > I'm detecting click OR mouseover and mouseout events on all markers > > under the mouse - not just the top most marker. > > My first link is the mouseover and mouseout version, my second link > > the click version. > > > Markers consume the Map click event so my single Map click event > > listener detects no Marker clicks unless you set the MarkerOption > > clickable to false. > > My code does this and it works as desired except i'd like the cursor > > to change when over a Marker - that doesn't happen when the > > MarkerOption clickable is false. > > >http://code.google.com/apis/maps/documentation/javascript/reference.h... > > > Anyway that demo defines a MarkerImage with a scaledSize set to the > > same size as the MarkerImage's size. > > If you read the thread i linked to you'll find that setting a > > MarkerImage scaledSize forces non-optimised Markers. > > So i changed my demo to pass null as scaledSize in the MarkerImage > > connstructor and thought that would give me optimised Markers and my > > existing code would still work but it doesn't. > > > Optimised Markers by default consume the Map mousemove event so my > > demo's mousemove event listener never executes. > > Much like the demo's click event listener never executes unless the > > MarkerOption clickable is set to false. > > (Non-optimised Markers with MarkerOption clickable set to true > > (default) do NOT consume the Map mousemove event). > > > Setting an optimised Marker's MarkerOption clickable to false stops > > the Marker from consuming the Map mousemove event and my code again > > works as desired - albeit with no change of cursor when over a Marker. > > > Here's a simple map that demonstrates this behavior: > > >http://developer.martinpearman.co.uk/markers_event_layer/mousemove_ev... > > > On that map, Markers are optimised and clickable - both these options > > are the defaults. > > Move the mouse over a group of Markers and you'll see the Map > > mousemove event listener stops updating the mouse position top center > > of map. > > >http://developer.martinpearman.co.uk/markers_event_layer/mousemove_ev... > > > That map uses non-optimised Markers that are clickable by default and > > the Map mousemove event listeners executes even when the mouse is over > > one or more Markers. > > >http://developer.martinpearman.co.uk/markers_event_layer/mousemove_ev... > > > Markers on this map are optimised but NOT clickable and the Map > > mousemove event listener executes as desired. > > > The documentation for Map events points out that the Map click event > > does NOT fire when a Marker is clicked on (it doesn't mention > > MarkerOption clickable), but doesn't mention that the Map mousemove > > event does not fire when the mouse is over an optimised Marker. > > > So my question - is this a bug or the intended behavior? > > > For my project i can set the MarkerOption clickable to false so BOTH > > my Map click and Map mousemove event listeners execute as desired and > > it will work. > > But i'd rather that at least with the Map mousemove event i can leave > > clickable set to true so that the mouse icon changes to a pointer when > > over a Marker. > > > Thanks for reading my long(ish) post! > > > Martin. > > > -- > > 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. -- 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.
