maptalks / maptalks/examples

vt示例需要改进的建议

Open
#141 0 comments 0 reactions 1 assignee View on GitHub

@yy923683900 is already working on this.

Since Jun 1, 2023.

Dominant language
JavaScript
Stars
73
Forks
32
PR merge metrics
No merged PRs in 30d

Description

from @deyihu

@Zhen 图层交互模块:
1.动态修改图层的配置,minZoom maxZoom,features(这个已经有好多同学问了吧)等属性(layer.config())
2.highlight操作,目前例子的还是太简单了,highlight在业务里应该是用的非常多的功能了(就是类geometry的事件交互和动态更新样式),例子里要体现出:
(1)条件的动态过滤性,filter可以简单的值,可以是函数
(2)symbol的多个值的表现行为:color ,opacity,bloom,visible等,里面具体可以配置哪些值我也不知道,你们根据需要在列子的体现

2.图层的identify操作,根据identify的数据动态设置改元素的样式(比如颜色的改变),即用户选中那条数据就高亮那条数据(identify+highlight),参考:
https://maptalks.org/examples/en/interaction/mouse-identify/#interaction_mouse-identify ,甚至可以加个infowindow,将idenfity出来的数据显示出来

修改建议
1.目前renderPlugin里,当用户配置的dataSource和type不匹配,或者不合法要给予提示,警告或者错误,目前是一点反应没有,一片白,用户根本发现不了自己配置错了,所有要明确告诉用户错在哪里,最后做个style validate函数,每个用户更新setStyle时进行style合法性验证

2.style的更新,包括dataSouce,SceneCongfi,symbol等不要用索引,用名字,即每个style item都有一个唯一的名字,举例:
style: [{
name:'building',
filter: ["all", ["==", "$layer", "building"],
["==", "$type", "Polygon"]
],
renderPlugin: {
dataConfig: {
type: "fill",
},
type: "fill",
},
symbol: {
polygonFill: "#2e7e57",
polygonOpacity: 1,
},
}, ],

vt.updateSymbol('building', {
polygonFill: "#f85635",
});
这个问题我给你说过,用索以这个方法太差了,如果对style item做任何的删,添加,排序等,立马GG

代码实现层面优先名字查找,找不到再用索引查询,如果都查不到就提示用户没有查找对应的style item

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.