Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into pre-release/0.9.2-…
Browse files Browse the repository at this point in the history
…alpha.2
  • Loading branch information
fangsmile committed Jul 25, 2023
2 parents 56a605f + 0030c64 commit 9106a7f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
23 changes: 21 additions & 2 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,27 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
}

let h = 0;
for (let i = startRow; i <= endRow; i++) {
h += this.getRowHeight(i);
// for (let i = startRow; i <= endRow; i++) {
// h +=
// this.rowHeightsMap.get(i) ||
// (this.isColumnHeader(0, i) || this.isCornerHeader(0, i)
// ? Array.isArray(this.defaultHeaderRowHeight)
// ? this.defaultHeaderRowHeight[i] ?? this.internalProps.defaultRowHeight
// : this.defaultHeaderRowHeight
// : this.internalProps.defaultRowHeight);
// }
// autoRowHeight || all rows in header, use accumulation
if (this.heightMode !== 'autoHeight' && this.internalProps.layoutMap && endRow >= this.columnHeaderLevelCount) {
for (let i = startRow; i < this.columnHeaderLevelCount; i++) {
// part in header
h += this.getRowHeight(i);
}
// part in body
h += this.defaultRowHeight * (endRow - Math.max(this.columnHeaderLevelCount, startRow) + 1);
} else {
for (let i = startRow; i <= endRow; i++) {
h += this.getRowHeight(i);
}
}
if (startRow >= 0 && endRow >= 0 && h > 0) {
this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async function moveCell(count: number, direction: 'up' | 'down', screenTopRow: n
(proxy.table as any).scenegraph.bodyGroup.firstChild.lastChild.row
);

// proxy.table.scenegraph.stage.render();
proxy.table.scenegraph.updateNextFrame();
await proxy.progress();
} else {
const distStartRow = direction === 'up' ? proxy.rowStart + count : proxy.rowStart - count;
Expand Down Expand Up @@ -154,6 +154,8 @@ async function moveCell(count: number, direction: 'up' | 'down', screenTopRow: n
if (proxy.table.heightMode === 'autoHeight') {
computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);
}
proxy.rowStart = distStartRow;
proxy.rowEnd = distEndRow;
for (let col = proxy.bodyLeftCol; col <= proxy.bodyRightCol; col++) {
for (let row = syncTopRow; row <= syncBottomRow; row++) {
// const cellGroup = proxy.table.scenegraph.getCell(col, row);
Expand All @@ -177,8 +179,6 @@ async function moveCell(count: number, direction: 'up' | 'down', screenTopRow: n
);
}

proxy.rowStart = distStartRow;
proxy.rowEnd = distEndRow;
proxy.currentRow = direction === 'up' ? proxy.currentRow + count : proxy.currentRow - count;
proxy.totalRow = direction === 'up' ? proxy.totalRow + count : proxy.totalRow - count;
proxy.referenceRow = proxy.rowStart + Math.floor((proxy.rowEnd - proxy.rowStart) / 2);
Expand All @@ -191,6 +191,7 @@ async function moveCell(count: number, direction: 'up' | 'down', screenTopRow: n
(proxy.table as any).scenegraph.bodyGroup.firstChild.lastChild.row
);

proxy.table.scenegraph.updateNextFrame();
if (proxy.table.heightMode !== 'autoHeight') {
await proxy.progress();
}
Expand Down

0 comments on commit 9106a7f

Please sign in to comment.