首页 > 解决方案 > Graticule 的 targetSize 属性是否意味着可动态更新?

问题描述

OpenLayers v6.3.1

我创建了一个地图并向其中添加了一个 OSM TileLayer() 和一个标线。通过以下方式创建的标线:

var graticule = new Graticule({
  // the style to use for the lines, optional.
  strokeStyle: new Stroke({
    color: "blue",
    width: 2
  }),
  showLabels: false,
  wrapX: false,
  targetSize: 30
});

如果我的 UI 上有一个滑块,我想控制显示的网格大小,我可以用它的值动态修改 graticule.targetSize 吗?我试过了,它不起作用。不确定这是设计使然还是错误。

见:https ://codesandbox.io/s/graticule-rby9m

注意 - 第一次加载上面的沙箱时,我总是必须点击重新加载按钮;不知道为什么。

问候和thanX -

标签: openlayers

解决方案


推荐阅读