antvis / L7

🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis engine.
https://l7.antv.antgroup.com
MIT License
3.67k stars 636 forks source link

vue3 使用 响应式ref绑定scene 使用l7-draw 工具报错 #2241

Closed Gor-c closed 10 months ago

Gor-c commented 10 months ago

版本: "@antv/l7": "^2.20.13", "@antv/l7-draw": "^3.1.1", "@antv/l7-maps": "^2.20.13",

示例代码:

import { Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import { ControlEvent, DrawControl } from '@antv/l7-draw';

const scene = new Scene({
  id: 'map',
  map: new GaodeMap({
    style: 'light',
    center: [116.1608, 40.1119],
    zoom: 15,
  }),
});
scene.on('loaded', () => {

  const drawControl = new DrawControl(scene, {});
  scene.addControl(drawControl);
  drawControl.on(ControlEvent.DrawChange, (changeType) => {
    console.log(changeType);
  });
});

源码里直接写死了 scene,导致 找不到对象内的 方法,是否应该 使用this 来统一处理 image

github-actions[bot] commented 10 months ago

hi @Gor-c, welcome!