【OpenLayers笔记】Feature选中交互

 
map.addInteraction(
      new Select({
        style: function (feature) {
          //可以返回单个Style也可以返回Array.<Style>
          return [
            new Style({
              //选中Feature之后描边线为白色
              stroke: new Stroke({ color: "#FFF", width: 8 }),
            }),
            new Style({
              //选中Feature之后实体线为绿色
              stroke: new Stroke({ color: "#00FF00", width: 5 }),
            }),
          ];
        },
      })
    );

 

效果:

 

posted @ 2022-09-27 11:44  碎月  阅读(70)  评论(0编辑  收藏  举报