Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/vtable-plugins/src/table-carousel-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export class TableCarouselAnimationPlugin implements pluginsDefinition.IVTablePl
if (customRow) {
this.row = customRow.distRow;
animation = customRow.animation ?? true;
} else if (this.row >= this.table.rowCount - 1) {
this.row = this.table.frozenRowCount;
animation = false;
} else if (isInteger(this.row) && screenTopRow !== this.row) {
this.row = this.table.frozenRowCount;
animation = false;
Expand All @@ -120,7 +123,6 @@ export class TableCarouselAnimationPlugin implements pluginsDefinition.IVTablePl
this.willUpdateRow = false;
this.updateRow();
},
// animation ? this.animationDuration + this.animationDelay : 0
this.animationDuration + this.animationDelay
);
}
Expand All @@ -135,6 +137,9 @@ export class TableCarouselAnimationPlugin implements pluginsDefinition.IVTablePl
if (customCol) {
this.col = customCol.distCol;
animation = customCol.animation ?? true;
} else if (this.col >= this.table.colCount - 1) {
this.col = this.table.frozenColCount;
animation = false;
} else if (isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== this.col) {
this.col = this.table.frozenColCount;
animation = false;
Expand All @@ -156,7 +161,6 @@ export class TableCarouselAnimationPlugin implements pluginsDefinition.IVTablePl
this.willUpdateCol = false;
this.updateCol();
},
// animation ? this.animationDuration + this.animationDelay : 0
this.animationDuration + this.animationDelay
);
}
Expand Down
13 changes: 8 additions & 5 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5309,18 +5309,21 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
}
const duration = !isBoolean(animationOption) ? animationOption?.duration ?? 3000 : 3000;
this.animationManager.scrollTo({ row: targetRow }, animationOption);
if (targetRowInt === targetRow) {
this._scrollToRowCorrectTimer = setTimeout(() => {
this.scrollToRow(targetRowInt, false);
}, duration);
}
this._scrollToRowCorrectTimer = setTimeout(() => {
this.scrollToRow(targetRowInt, false);
}, duration);
}
scrollToCol(col: number, animationOption?: ITableAnimationOption | boolean) {
if (!animationOption) {
this.scrollToCell({ col });
return;
}
const duration = !isBoolean(animationOption) ? animationOption?.duration ?? 3000 : 3000;
this.animationManager.scrollTo({ col }, animationOption);
setTimeout(() => {
this.scrollToCell({ col: Math.floor(col) });
this.render();
}, duration);
}
/**
* 滚动到具体某个单元格位置
Expand Down
4 changes: 2 additions & 2 deletions packages/vtable/src/core/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function isInteger(value: number) {
class Animateaaa extends ACustomAnimate<any> {
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {
if (this.from.x !== this.to.x) {
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
const x = end ? this.to.x : this.from.x + Math.round((this.to.x - this.from.x) * ratio);
this.params.table.scrollLeft = x;
}
if (this.from.y !== this.to.y) {
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
const y = end ? this.to.y : this.from.y + Math.round((this.to.y - this.from.y) * ratio);
this.params.table.scrollTop = y;
}
}
Expand Down
Loading