Skip to content
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

拖动过程中mapbox地图会滞后 #17

Open
amengpp opened this issue Jun 10, 2020 · 8 comments
Open

拖动过程中mapbox地图会滞后 #17

amengpp opened this issue Jun 10, 2020 · 8 comments

Comments

@amengpp
Copy link

amengpp commented Jun 10, 2020

在拖动过程中,mapbox 底图会明显滞后于maptalks图层。使用同样的方法集成3D高德和百度地图,也是一样的滞后感。原因可能是mapbox的jumpTo是异步的。
问题:有没有更好的方式集成3D底图,比如mapbox和高德地图?

@fuzhenn
Copy link
Member

fuzhenn commented Jun 10, 2020

老版本的mapbox-gl的jumpTo没有出现你说的现象,可能是新版本里造成的。
不晓得是不是需要改成另外的方法?这个需要研究一下。
你有兴趣做一下研究,提个PR给我吗?

@amengpp
Copy link
Author

amengpp commented Jun 11, 2020

demo/index.html中的mapbox版本(mapbox-gl-js/v0.44.1)也同样有问题。原因应该是,在maptalks的frameloop中调用了drawLayers后,maptalks中的其他层已经进行的真实的渲染,但是,MapboxglLayer 只是在drawOnInteracting->_syncMap中调用了mapbox的jumpTo函数,jumpTo中才调用requestAnimationFrame,真正的绘画要等到下一帧的“Animation Frame Fired”。
因此,快速拖动的时候就有很明显的滞后感。
不过,不知道怎么改,有没有建议?

@fuzhenn
Copy link
Member

fuzhenn commented Jul 19, 2020

sorry,现在才看到,你分析的很像是原因,那可能需要找mapbox-gl中能在当前帧里就更新地图状态的函数。

@tiztm
Copy link

tiztm commented Jul 29, 2020

这个问题我也遇到了,其实很好解决。

更新到最新的mapbox 比如1.11.1 就好啦

@amengpp
Copy link
Author

amengpp commented Aug 5, 2020

其实是模仿代码写的百度和高德的接口。目前为止,百度和高德api还是滞后的。

@feiyuanxin
Copy link

feiyuanxin commented Aug 15, 2020

mapbox gl同步问题,可以参考这个修复 mapbox/mapbox-gl-js#7893

@taotao-github
Copy link

将this.glmap.jumpTo(cameraOptions); 改为
this.glmap
.setCenter(cameraOptions.center)
.setZoom(cameraOptions.zoom)
.setBearing(cameraOptions.bearing)
.setPitch(cameraOptions.pitch);
就可以解决问题

@GISHUB2017
Copy link

GISHUB2017 commented May 10, 2023

更新相机姿态后
this.glmap.jumpTo(cameraOptions);

调用mapboxgl地图再次渲染
this.glmap._render();

就可以实现即时渲染了

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

No branches or pull requests

6 participants