antvis / L7Draw

L7 绘制控件
MIT License
48 stars 31 forks source link

关于绘制过程中,卡顿的情况 #155

Closed zrnwsy closed 11 months ago

zrnwsy commented 11 months ago

L7Draw这个插件效果非常漂亮,我使用的过程中遇到一个问题,比如绘制一个矩形,鼠标点了第一个点,拖动的过程中,形状没有很跟随鼠标,感觉又点卡卡的。但是看官方react版本的示例[https://l7draw.antv.vision/example/map/gaode],却没有这种情况,绘制的过程鼠标拖动绘制很流畅,这是为啥?有大佬可以指点一下我吗?我是遗漏了什么细节吗?我代码是这样子:<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>l7-draw</title>
    <script src="https://unpkg.com/@antv/l7"></script>
    <script src="https://unpkg.com/@antv/l7-draw"></script>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      html,
      body,
      #map {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      const scene = new L7.Scene({
        id: "map",
        map: new L7.GaodeMap({
          center: [120.151634, 30.244831],
          pitch: 0,
          style: "dark",
          zoom: 10,
        }),
      });
      scene.on("loaded", () => {
        const drawControl = new L7.Draw.DrawControl(scene, {
          defaultActiveType: "rect",
        });

        scene.addControl(drawControl);
      });
    </script>
  </body>
</html>
cuidong626 commented 11 months ago

浏览器控制台关了

zrnwsy commented 11 months ago

浏览器控制台关了 感谢大佬。关闭了浏览器控制台,确实是不卡了,这是为为啥?