【发布时间】:2021-12-27 18:56:35
【问题描述】:
我正在尝试将“Epicenter”设置为创建的 Vector,我使用 Text、Fill 和 Stroke 作为 Style,然后将此 style 发送到我的向量,但它什么也没显示。
const epicenterStyle = new ol.style.Style({
text: new ol.style.Text({
font: '12px Calibri,sans-serif',
fill: new ol.style.Fill({
color:'#000'
}),
stroke: new ol.style.Stroke({
color:'#fff',
width:3
}),
textAlign:'left',
offsetX:2
})
});
pointEarthquake = new ol.layer.Vector({
source: new ol.source.Vector({
features: [position]
}),
visible: true,
title: "Evento sísmico",
style: epicenterStyle.setText('Epicenter')
})
还尝试了 Vector style: epicenterStyle.getText().setText('Epicenter')
【问题讨论】:
标签: openlayers