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

layer 配置了{autoRender:false}之后,其父scene调用snapshot一直显示为pendding #51

Closed
tangxiangmin opened this issue Sep 26, 2018 · 2 comments

Comments

@tangxiangmin
Copy link

tangxiangmin commented Sep 26, 2018

首先感谢spritejs这个框架,目前已经写了两个比较有趣的项目了。

const scrawlLayer = this.scene.layer('scrawl', {autoRender: false});
// do something

this.scene.snapshot().then(res=>{
  // never run here
}).catch(e=>{
  // never run here too
})

这是在项目中偶然发现的,发现移除改配置或者在截图前移除该layer后,才可截图成功,具体bug原因等我这两天忙完了再看下

@akira-cn
Copy link
Contributor

你配置了layer的autoRender是false的话,就要在snapshot之后自己手工调用一下layer.draw,否则snapshot截屏不了,因为snapshot需要等待layer绘制完成。

const scrawlLayer = this.scene.layer('scrawl', {autoRender: false});
// do something

this.scene.snapshot().then(res=>{
  // never run here
}).catch(e=>{
  // never run here too
})

scrawLayer.draw(); //这样就可以了

@tangxiangmin
Copy link
Author

你配置了layer的autoRender是false的话,就要在snapshot之后自己手工调用一下layer.draw,否则snapshot截屏不了,因为snapshot需要等待layer绘制完成。

const scrawlLayer = this.scene.layer('scrawl', {autoRender: false});
// do something

this.scene.snapshot().then(res=>{
  // never run here
}).catch(e=>{
  // never run here too
})

scrawLayer.draw(); //这样就可以了

嗯嗯,谢谢你的回复

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

2 participants