OL5 如何通过单击区域内部而不是仅单击行来启用 box/polygon 选择?
OL5 How to enable box/polygon selection by clicking inside area not just on lines?
我从 OL4 升级到 OL5,现在升级到 select 一个多边形,我必须专门单击边界,而在此之前我可以单击多边形内部的任何地方。对于圈子,我仍然可以点击圈子内的任何地方来 select 它。这让我们的最终用户感到困惑,他们认为 selecting 对象不再有效。
这是故意升级的吗?如果是这样,我如何才能通过单击其区域内的任意位置来制作多边形 select?
我还没能在网上找到任何关于这个问题的参考资料。
此 https://github.com/openlayers/openlayers/pull/7750 在版本 5.0.0 的升级说明中引用。
如果您在OL4中使用的是没有填充的样式,例如
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#3399CC',
width: 1.25
})
})
您需要为 OL5 添加透明填充:
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#3399CC',
width: 1.25
}),
fill: new ol.style.Fill({
color: 'transparent'
})
})
我从 OL4 升级到 OL5,现在升级到 select 一个多边形,我必须专门单击边界,而在此之前我可以单击多边形内部的任何地方。对于圈子,我仍然可以点击圈子内的任何地方来 select 它。这让我们的最终用户感到困惑,他们认为 selecting 对象不再有效。 这是故意升级的吗?如果是这样,我如何才能通过单击其区域内的任意位置来制作多边形 select?
我还没能在网上找到任何关于这个问题的参考资料。
此 https://github.com/openlayers/openlayers/pull/7750 在版本 5.0.0 的升级说明中引用。
如果您在OL4中使用的是没有填充的样式,例如
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#3399CC',
width: 1.25
})
})
您需要为 OL5 添加透明填充:
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#3399CC',
width: 1.25
}),
fill: new ol.style.Fill({
color: 'transparent'
})
})