我一直在关注 OpenLayers 网站上的 Icon Colors 示例:http://openlayers.org/en/latest/examples/icon-color.html?q=color。
当我使用 png 和 jpg 图像时,这对我很有效,但当我切换到使用 svg 图像时,颜色根本没有改变。没有错误出现,颜色就是不会改变。
这里是代码片段,其中发生颜色更改:
/*set the colour*/
var style = new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 0.5],
src : 'img/icons/example.svg',
color: '#8959A8'
}))
});
任何建议都将不胜感激!