我刚从 4.5 版升级到 OpenLayers 10.4。我需要获取用户点击时的所有功能。所以我使用
map.forEachFeatureAtPixel(pixel, function (feature, layer) { .... }));
当指定该位置的多边形的填充颜色时,它可以正常工作。
new ol.style.Style({
fill: new ol.style.Fill({ color: [0xfb, 0x7f, 0x7f, 0.7] }),
stroke: new ol.style.Stroke({ color: "#ff0000", width: 1 })
})
它不返回填充样式等于空的多边形:
new ol.style.Style({
fill: null,
stroke: new ol.style.Stroke({ color: "#F44444", width: 1 })
})
使用 4.5 版本时运行正常。请问有人能提供建议吗?如何解决这个问题?