0
我想重新使用我的基本样式函数来通过覆盖某些属性来创建选择样式。 此方法适用于线条,多边形和文本的填充/描边颜色,但不适用于图像(我的情况为圆形)。 我不想创建一个新的图像,因为应保留其他属性。覆盖OpenLayers中选择的样式属性
var selectStyleFunction = function(feature, resolution) {
var style = styleFunction(feature, resolution)[0];
style.getImage().getFill().setColor("magenta");
console.log(style.getImage().getFill().getColor());
return [style];
};
在此fiddle你可以看到,虽然日志输出是正确的,上面的代码不会改变选择的要素样式。
有什么办法可以覆盖这个属性吗?
有一个关于此的讨论:https://github.com/openlayers/openlayers/issues/5775 –
谢谢你的回答,但我不明白这个讨论与我的问题有关。据我了解,这是关于绘制圆圈的效率。 – anste
正如你可以看到引用的问题https://github.com/openlayers/openlayers/issues/6233可能有某种信息。 –