javascriptgoogle-mapsgoogle-maps-api-3google-fusion-tablesdom-events

FusionTablesLayer Polygon with styleId click event not firing


I have a fusion table that I want to use with a styleid to configure the appearance. It seems that a FusionTablesLayer with a styleid cannot have a click event attached.

Here is an example of the FusionTablesLayerOptions I am using:

settings: {
    query: {
        select: 'geometry',
        from: '<<my table id>>'
    },
    suppressInfoWindows: true,
    styleId: 2
}

And here is the click event that does not fire:

google.maps.event.addListener(<<my FusionTablesLayer obj>>, 'click', function () {
    console.log('layer click');
});

When I change the FusionTablesLayerOptions to this, the event does fire:

settings: {
    query: {
        select: 'geometry',
        from: '<<my table id>>'
    },
    suppressInfoWindows: true
}

So my question is - do you think that layers with a styleId don't support click events? Or am I missing something?


Solution

  • Ok I solved it:

    1. There is a "styledId" property in FusionTablesLayerOptions and its documented here

    2. This issue was being caused by the opacity of the polygon fill color. Seems that if the opacity of a polygon fill is set to 0% then no click events attached to the layer will fire. Setting the opacity to 1% fixed this issue straight away. I have added an image here to demonstrate.