mapbox - 使用 Mapbox gl 绘制,在覆盖多边形特征的圆半径后,如何放大所选顶点的圆半径?
问题描述
在官方demo中,在“draw_polygon”模式下创建多边形后,当你direct_select多边形上的一个顶点时,该顶点将被放大。https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
在这个 js 小提琴中:https : //jsfiddle.net/frankzhang2046/y49mhtjx/16/ 在覆盖第 258-271 行中顶点的样式规则后,“direct_select”下的选定顶点不再放大。
想知道我可以使用什么 API/选择器来定位选定的顶点以恢复“选定时放大”行为。谢谢。
{
id: "i-guess-id-doesnt-matter",
type: "circle",
filter: [
"all",
["==", "meta", "vertex"],
["==", "$type", "Point"],
["!=", "mode", "static"],
],
paint: {
"circle-radius": 3,
"circle-color": "green"
},
},
解决方案
更新:在未缩小的 MapboxDraw 库中发现了用于定位选定顶点的规则集。改变圆半径变大解决了这个问题
{
'id': 'gl-draw-point-active',
'type': 'circle',
'filter': ['all',
['==', '$type', 'Point'],
['!=', 'meta', 'midpoint'],
['==', 'active', 'true']],
'paint': {
'circle-radius': 5,
'circle-color': colorHexVal
}
},
推荐阅读
- crash - 如何在 JVM 生成的 hs_err_pidxxx.log 中读取“栈顶”
- fortran - 隐式无,隐式转换
- swift - 我将如何调整和压缩云功能中的视频
- angular - 级联
- python - Python,LXML ElementTree 没有使用 STYLE 元素制作元素树
- python - Django:试图理解访问 request.session[SESSION_KEY] 的语法
- javascript - Ant Design - 在选择中搜索键和值
- mvvm - 无法使用 mvvm:ViewModelLocator 创建视图的 XAML 数组
- react-redux - 嵌套调度函数没有获取更新道具
- python - groupby 在多索引的子集上