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

【补充】记录小程序开发的踩坑历程 canvas踩坑第一条 #2

Open
gniria opened this issue Oct 17, 2018 · 0 comments
Open

Comments

@gniria
Copy link

gniria commented Oct 17, 2018

由于Js core和UI core的通讯问题,canvas的draw操作并不是实时的,相当于js发出指令(比如drawImage)交给UI执行,这需要一个过程,如果在js端调用完draw直接调用canvasToTempFilePath会导致导出的图片空白或只有部分,基于此,一般做法是延时调用canvasToTempFilePath,根据设备性能,draw可能耗时几十到几百ms,所以设置300ms的话绝大部分情况下都是满足要求的,虽说微信现在给draw提供了callback参数,但并不太好用,尤其是绘制比较复杂,多次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

1 participant