this.length--;
if (index!==this.length){
var end=this.elements[this.length];
// @xd added, 添加end是存存在判断
if(end){
this.elements[index]=end;
end._setIndexInList(index);
}
}
}
var old_func = Laya.SimpleSingletonList.prototype.add;
Laya.SimpleSingletonList.prototype.add = function(element){
var index=element._getIndexInList();
// add, 添加安全性判断.
if (index!==-1){
LogsManager.echo("SimpleSingletonList:element has in SingletonList.");
return;
}
8 个回复
杜1
赞同来自: 月亮真扁
/**解决因为卡顿在多点触摸期间导致的bug*/
private static SingletonList_expand(){
Laya.SingletonList.prototype["_remove"] = function(index){
// @xd added, 如果index == -1 不执行
if(index == -1){
return;
}
this.length--;
if (index!==this.length){
var end=this.elements[this.length];
// @xd added, 添加end是存存在判断
if(end){
this.elements[index]=end;
end._setIndexInList(index);
}
}
}
var old_func = Laya.SimpleSingletonList.prototype.add;
Laya.SimpleSingletonList.prototype.add = function(element){
var index=element._getIndexInList();
// add, 添加安全性判断.
if (index!==-1){
LogsManager.echo("SimpleSingletonList:element has in SingletonList.");
return;
}
old_func.call(this,element);
}
}
刘文
赞同来自:
1567490675用户
赞同来自:
Aar0n
赞同来自:
Kerry
赞同来自:
MasterYi
赞同来自:
dpapa
赞同来自:
laya.d3.js -> SimpleSingletonList.Clear -> for (var i = 0, n = this.length; i < n; i++)
引擎代码 i没有赋初值,导致 i<n永远为false.
沃德提安呐·郝舒艾
赞同来自: