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

ImageLayer 更新Extent后没有效果 #861

Closed
fallowu opened this issue Feb 20, 2019 · 3 comments
Closed

ImageLayer 更新Extent后没有效果 #861

fallowu opened this issue Feb 20, 2019 · 3 comments

Comments

@fallowu
Copy link

fallowu commented Feb 20, 2019

maptalks's version and what browser you use?

0.43.0
Issue description

准备图片铺满整个地图,缩放时仍然铺满。使用滚轮缩放地图,监听事件,更新imageLayer extent为map.getExtent(),事件触发了, console出来的imageLayer里的extent也更新了,但是没有效果。
不知道是不是哪里错了。还请看下。

      map.on('zooming zoomend', function(e) {
        var images=imageLayer.getImages()
        images[0].extent = map.getExtent()
        imageLayer.setImages(images)
        console.log(imageLayer)
      })    

Please provide a reproduction URL (on any jsfiddle like site)

https://codepen.io/fallowu/pen/ErGoba

@fuzhenn
Copy link
Member

fuzhenn commented Feb 21, 2019

谢谢提issue,我这里重现了这个问题,确实不太正常,我会找时间看一下。

@deyihu
Copy link
Collaborator

deyihu commented Feb 22, 2019

初步确定因为图片的url一样(每个图片被加载后会缓存在ImageLayer实例里),导致重置ImageLayer的images(这时图片的url和上一次一样)的时候会从缓存中直接提取image(而image如被gl render后会绑定 glBuffer的值)导致;

解决方案为每次渲染时删除 image 的 glBuffer就可以了

我待会把代码提交过来

@fallowu https://deyihu.github.io/src/html/imagelayer.html

deyihu added a commit to deyihu/maptalks.js that referenced this issue Feb 22, 2019
@fallowu
Copy link
Author

fallowu commented Feb 22, 2019

感谢对应。

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

3 participants