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

[fix]laya2.0+虚拟列表赋值数据执行2次itemRenderer函数 #41

Open
krapnikkk opened this issue Mar 1, 2020 · 1 comment
Open

Comments

@krapnikkk
Copy link

laya虚拟列表赋值数据执行2次itemRenderer函数

遇到和论坛的同样问题,研究发现Laya2.0引擎内部升级导致的

Laya 2.0以上对Timer中的callLater的逻辑进行了解耦合,而在Laya 1.7中,是将callater的时钟处理放在Timer中,所以Timer.clear无法清理这个Laya.timer.callLater定时器

源代码【Glist中有两处的Laya.timer.clear是清理_refreshVirtualList不了的】
if (this._virtualListChanged != 0) Laya.timer.clear(this, this._refreshVirtualList); this._refreshVirtualList();

调整为:
if (this._virtualListChanged != 0) Laya.CallLater.I._laters.forEach((element, index) => { if (element.method.name == "_refreshVirtualList") { Laya.CallLater.I._laters.splice(index, 1); } }); this._refreshVirtualList();

已向引擎组提相关的issue

@xiaoguzhu
Copy link
Member

那其实不用callLater,改成用timer一个很短的时间?

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