Skip to content

src目录下Animation文件的Player类,反复销毁创建地图时可能会出现错误导致地图不再渲染 #2525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Particaly opened this issue Apr 8, 2025 · 4 comments · May be fixed by #2526
Labels

Comments

@Particaly
Copy link

Particaly commented Apr 8, 2025

maptalks@1.0.5

 else if (this.playState === 'running') {
      this._framer(() => {
          if (this.playState !== 'running') {
              // this._run();
              return;
          }
          this.currentTime = elapsed;
          if (onFrame) {
              onFrame(frame); // 此处出现错误,会卡住整个地图,地图无法进行任何操作
          }
          this._run();
      });
  }

Image

具体报错是在Position._sub方法,调用时x参数传入的是null,我尝试了修改为判断为空时跳过,但是导致了另一个报错

不想深入,尝试try-catch包裹此处onFrame,后续也不影响渲染

我也不太懂这块代码,不确定这么做对不对

@deyihu
Copy link
Collaborator

deyihu commented Apr 8, 2025

@Particaly 看着像是动画时地图被移除导致的,需要你给个简单的复现的代码

@Particaly
Copy link
Author

@deyihu 感谢回复,写复现demo的时候发现是确实是动画部分导致的

复现demo

flyTo紧跟fitExtent,即使flyTo的duration为0,也会报错

@deyihu deyihu linked a pull request Apr 8, 2025 that will close this issue
@deyihu
Copy link
Collaborator

deyihu commented Apr 8, 2025

@Particaly 我提了个pr过去了,应该解决你的问题了

Image

@deyihu deyihu added the bug label Apr 8, 2025
@Particaly
Copy link
Author

@deyihu 好的,再次感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants