Map mousemove event not firing when move on overlays

629 views
Skip to first unread message

Nianwei Liu

unread,
Nov 29, 2011, 4:24:43 PM11/29/11
to Google Maps JavaScript API v3
This is rather unexpected for the API.
The map's mousemove event is not firing when the mouse is moving on
top of some overlay. I know in V2 this does not happen so I can
display coordinates as mouse move.
If this behavior by design for v3 that would be really bad for some
apps. Caught me by surprise while trying to debug something and
eventually trace down to this problem.

Test page:
http://gmaps-utility-gis.googlecode.com/svn-history/r375/trunk/v3test/mapmousemove/mapmousemove.html

Marcelo

unread,
Nov 29, 2011, 5:27:04 PM11/29/11
to Google Maps JavaScript API v3
I never used a FusionTablesLayer, but with ordinary polygons you need
to set clickable:false in the options for the map to register the
events. Otherwise the overlay absorbs them.

--
Marcelo - http://maps.forum.nu
--

> Test page:http://gmaps-utility-gis.googlecode.com/svn-history/r375/trunk/v3test...

Martin™

unread,
Nov 30, 2011, 12:01:56 AM11/30/11
to Google Maps JavaScript API v3

Nianwei Liu

unread,
Nov 30, 2011, 6:48:15 AM11/30/11
to Google Maps JavaScript API v3
It's not unusual that the app may require the overlay clickable AND
map mousemove event available.
The map.mouseevent documentation did not say anything about this, if
it did, it would be something strange, like: "event may not be
reliable if you want use clickable overlay".
I'd argue that overlay absorb the mouse event is not the correct
behavior, especially mousemove events, which are typically used for
background tasks.
For "click" event it is more acceptable to absorb the click event for
underneath overlays because you did not really "click" the underneath
overlay if some other overlay is on top (if we let opacity out of the
argument). However, even in that case, the Map, not the lower overlay,
should still receive the event.


Martin™

unread,
Nov 30, 2011, 7:21:14 AM11/30/11
to Google Maps JavaScript API v3
Hi.

Ideally the API would give us an option to select whether Overlays
consume the mousemove event.

Maybe one of us should start a feature request?

Martin.

Reply all
Reply to author
Forward
0 new messages