提交 9b07ea4e 编写于 作者: P pissang

fix(List): fix each not use rawIdx bug.

上级 14270b59
...@@ -1199,24 +1199,25 @@ class List< ...@@ -1199,24 +1199,25 @@ class List<
const storageArr = this._storageArr; const storageArr = this._storageArr;
for (let i = 0, len = this.count(); i < len; i++) { for (let i = 0, len = this.count(); i < len; i++) {
const rawIdx = this.getRawIndex(i);
// Simple optimization // Simple optimization
switch (dimSize) { switch (dimSize) {
case 0: case 0:
(cb as EachCb0<Ctx>).call(fCtx, i); (cb as EachCb0<Ctx>).call(fCtx, i);
break; break;
case 1: case 1:
(cb as EachCb1<Ctx>).call(fCtx, storageArr[dimIndices[0]][i], i); (cb as EachCb1<Ctx>).call(fCtx, storageArr[dimIndices[0]][rawIdx], i);
break; break;
case 2: case 2:
(cb as EachCb2<Ctx>).call( (cb as EachCb2<Ctx>).call(
fCtx, storageArr[dimIndices[0]][i], storageArr[dimIndices[1]][i], i fCtx, storageArr[dimIndices[0]][rawIdx], storageArr[dimIndices[1]][rawIdx], i
); );
break; break;
default: default:
let k = 0; let k = 0;
const value = []; const value = [];
for (; k < dimSize; k++) { for (; k < dimSize; k++) {
value[k] = storageArr[dimIndices[k]][i]; value[k] = storageArr[dimIndices[k]][rawIdx];
} }
// Index // Index
value[k] = i; value[k] = i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册