gpt4 book ai didi

mapbox-gl-js - 如何在 mapbox-gl 中为图层文本字段添加背景颜色

转载 作者:行者123 更新时间:2023-12-04 05:08:54 31 4
gpt4 key购买 nike

如何在 mapbox-gl 中为图层文本字段添加背景颜色 .. 或者如何完成以便文本字段上有背景框

map.addLayer({
"id": "markers",
"type": "symbol",
"source": "markers",
"layout": {
"icon-image": "{marker-symbol}-15",
"text-field": "{title}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top"
}
});

最佳答案

虽然我也不知道如何绘制背景框,但我们可能正在寻找相同的东西,即隐藏自定义标签下方的任何其他文本,使其弹出并更清晰。如果是这样,我确实发现您可以添加一个“光环”来达到预期的效果。

"layout": {
"icon-image": symbol + "-15",
"icon-allow-overlap": true,
"text-field": symbol,
"text-font": ["Open Sans Bold", "Arial Unicode MS Bold"],
"text-size": 11,
"text-transform": "uppercase",
"text-letter-spacing": 0.05,
"text-offset": [0, 1.5]
},
"paint": {
"text-color": "#202",
"text-halo-color": "#fff",
"text-halo-width": 2
},

这是取自 this example在他们的网站上。

关于mapbox-gl-js - 如何在 mapbox-gl 中为图层文本字段添加背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36774020/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com