带有styleId点击事件的FusionTablesLayer多边形不会触发 [英] FusionTablesLayer Polygon with styleId click event not firing
问题描述
我有一个融合表,我想用styleid来配置外观。似乎具有styleid的FusionTablesLayer不能附加一个单击事件。
以下是我使用的FusionTablesLayerOptions示例:
设置:{
query:{
select:'geometry',
from:'<< my table id>>'
},
suppressInfoWindows: true,
styleId:2
}
这里的click事件不会触发:
google.maps.event.addListener(<<<<<<<>>> ,function(){
console.log('layer click');
});
当我将FusionTablesLayerOptions更改为此时,事件会触发:
settings:{
query:{
select:'geometry',
from:'<< my table id> ;>'
},
suppressInfoWindows:true
}
所以我的问题是 - 你们认为带有styleId的图层不支持点击事件吗?或者我错过了什么?
谢谢!
解决了它:
-
FusionTablesLayerOptions中有一个styledId属性,它的文档 here
多边形填充颜色的不透明度。似乎如果多边形填充的不透明度设置为0%,则不会触发附加到图层的点击事件。将不透明度设置为1%可以立即解决此问题。我已在此处添加了一张图片以供演示。
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 guys think that layers with a styleId don't support click events? Or am I missing something?
Thanks!
Ok I solved it:
There is a "styledId" property in FusionTablesLayerOptions and its documented here
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.
这篇关于带有styleId点击事件的FusionTablesLayer多边形不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!