Polygon click events "hidden" by FusionTablesLayer click events?

490 views
Skip to first unread message

geoco...@gmail.com

unread,
Oct 1, 2011, 3:08:35 PM10/1/11
to Google Maps JavaScript API v3
See this example:
http://www.geocodezip.com/geoxml3_test/v3_FusionTables_CountryTestF.html

click on the polygon, the FusionTablesLayer click event fires.

click on the "Hide Layer" button, then click on the polygon, the
polygon click event fires.

Why is the polygon click event "hidden" by the FusionTablesLayer?
How can we make the polygon click event take precedence over the
FusionTablesLayer click event?

-- Larry

Masashi.K

unread,
Oct 1, 2011, 4:56:16 PM10/1/11
to Google Maps JavaScript API v3
How about using two FusionTableLayer?
One layer use to base layer (blue), and the other one use to
polygon(red).
When the red layer is clicked, call "red_layer.setMap(null);" then the
polygon layer will be hide.

On 10月1日, 午後12:08, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:

geoco...@gmail.com

unread,
Oct 1, 2011, 5:20:54 PM10/1/11
to Google Maps JavaScript API v3
On Oct 1, 4:56 pm, "Masashi.K" <wf9a5...@gmail.com> wrote:
> How about using two FusionTableLayer?
> One layer use to base layer (blue), and the other one use to
> polygon(red).
> When the red layer is clicked, call "red_layer.setMap(null);" then the
> polygon layer will be hide.

It is an observation of the behavior of the v3 maps API.

What I want to know is how to make a native polygon appear above a
FusionTablesLayer (or I assume a KmlLayer).

Or alternatively, how this behavior is described in the documentation
or how I can understand it?

-- Larry

Enoch Lau (Google Employee)

unread,
Oct 1, 2011, 9:42:19 PM10/1/11
to google-map...@googlegroups.com
I believe geometries in a FusionTablesLayer/KmlLayer always take precedence over Polygons for mouse events.

Enoch

geoco...@gmail.com

unread,
Oct 1, 2011, 10:18:51 PM10/1/11
to Google Maps JavaScript API v3
On Oct 1, 9:42 pm, "Enoch Lau (Google Employee)" <enoch...@google.com>
wrote:
> I believe geometries in a FusionTablesLayer/KmlLayer always take precedence
> over Polygons for mouse events.

Is there a way to change that?

Seems to me if I have a v3 map with a FusionTablesLayer or KmlLayer on
it and I add a Polygon to that, I probably want the polygon for a
reason (to capture clicks, mouseover/out events).

-- Larry

>
> Enoch

geoco...@gmail.com

unread,
Oct 1, 2011, 10:25:32 PM10/1/11
to Google Maps JavaScript API v3
On Oct 1, 10:18 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
The FusionTablesLayer blocks mouseover events.
http://www.geocodezip.com/geoxml3_test/v3_FusionTables_CountryTestH.html

-- Larry

>
>   -- Larry
>
>
>
>
>
>
>
>
>
> > Enoch

Chris Broadfoot

unread,
Oct 2, 2011, 3:57:28 AM10/2/11
to google-map...@googlegroups.com
Hi Larry,

This is in part because FusionTablesLayer (and KmlLayer & co) don't have the ability to re-order based on z-index.

Please star this feature request:

Thanks

>
>   -- Larry
>
>
>
>
>
>
>
>
>
> > Enoch

--
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-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Chris Broadfoot

unread,
Oct 2, 2011, 3:59:57 AM10/2/11
to google-map...@googlegroups.com
Sorry, I spoke too early. It wasn't clear that the Polygon is rendered on top (i.e. higher z-index) than the FusionTablesLayer.

Definitely sounds like a bug. Can you file one on the issue tracker please?

--

geoco...@gmail.com

unread,
Oct 2, 2011, 9:30:30 AM10/2/11
to Google Maps JavaScript API v3
On Oct 2, 3:57 am, Chris Broadfoot <c...@google.com> wrote:
> Hi Larry,
>
> This is in part because FusionTablesLayer (and KmlLayer & co) don't have the
> ability to re-order based on z-index.
>
> Please star this feature request:http://code.google.com/p/gmaps-api-issues/issues/detail?id=2804

I did that a long time ago. But this isn't an issue with displaying
layers, it is the click/mouseover/mouseout listeners.

-- Larry

>
> Thanks
> Chris
>
> --http://twitter.com/broady
>
> On Sun, Oct 2, 2011 at 1:25 PM, geocode...@gmail.com

geoco...@gmail.com

unread,
Oct 2, 2011, 10:12:59 AM10/2/11
to Google Maps JavaScript API v3
On Oct 2, 3:59 am, Chris Broadfoot <c...@google.com> wrote:
> Sorry, I spoke too early. It wasn't clear that the Polygon is rendered on
> top (i.e. higher z-index) than the FusionTablesLayer.
>
> Definitely sounds like a bug. Can you file one on the issue tracker please?

Done.

http://code.google.com/p/gmaps-api-issues/issues/detail?id=3661

-- Larry

>
> --http://twitter.com/broady
>
>
>
>
>
>
>
> On Sun, Oct 2, 2011 at 6:57 PM, Chris Broadfoot <c...@google.com> wrote:
> > Hi Larry,
>
> > This is in part because FusionTablesLayer (and KmlLayer & co) don't have
> > the ability to re-order based on z-index.
>
> > Please star this feature request:
> >http://code.google.com/p/gmaps-api-issues/issues/detail?id=2804
>
> > Thanks
> > Chris
>
> > --
> >http://twitter.com/broady
>
> > On Sun, Oct 2, 2011 at 1:25 PM, geocode...@gmail.com <geocode...@gmail.com

Berry Ratliff

unread,
Oct 2, 2011, 12:40:25 PM10/2/11
to Google Maps JavaScript API v3
The defaultUI blocks mouse events intended for elements in the
"overlayLayer" pane. It first appeared about six months ago.

Try:

foobar.setOptions({streetViewControl:false});

It is a hack but it works in my case.

geoco...@gmail.com

unread,
Oct 2, 2011, 12:59:08 PM10/2/11
to Google Maps JavaScript API v3
What is foobar? Is it the map?

Doesn't seem to work if it is.

-- Larry

Enoch Lau (Google Employee)

unread,
Oct 3, 2011, 2:17:47 AM10/3/11
to google-map...@googlegroups.com
Yeah it makes sense that if polygons are shown on top, they should get mouse events first - thanks for filing a bug.

Enoch

Berry Ratliff

unread,
Oct 10, 2011, 11:01:00 AM10/10/11
to Google Maps JavaScript API v3
On Oct 3, 7:17 am, "Enoch Lau (Google Employee)" <enoch...@google.com>
wrote:
> Yeah it makes sense that if polygons are shown on top, they should get mouse
> events first - thanks for filing a bug.
>
> Enoch

CANVAS does not support "real" mouse events for polys. The "zIndex"
order is just the "drawing" order for everything in the same CANVAS
tile. The API has to "fake" mouse events with "Point in Poly"
analysis in reverse order for the clicked tile. Built-in CANVAS
methods make it both fast & easy. Perhaps the API ought to return all
overlapping clicked elements rather than just one.
Reply all
Reply to author
Forward
0 new messages