Skip to content

Commit

Permalink
Merge pull request #460 from VisActor/dev/0.13.0
Browse files Browse the repository at this point in the history
Dev/0.13.0
  • Loading branch information
fangsmile authored Oct 25, 2023
2 parents b49299a + b49d4ad commit 62e39f4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: [Bug] set records blank scroll error #458\n\n",
"type": "patch",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
8 changes: 4 additions & 4 deletions packages/vtable/src/scenegraph/graphic/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ export class Chart extends Group {
// to avoid async render when chart is releasd
this.activeChartInstance.updateViewBox(
{
x1: -2000,
x2: -1000,
y1: -2000,
y2: -1000
x1: -1000,
x2: -800,
y1: -1000,
y2: -800
},
false,
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function createGroupForFirstScreen(
);

// update progress information
if (!bodyGroup.firstChild) {
if (!bodyGroup.firstChild && !colHeaderGroup.firstChild) {
// 无数据
proxy.currentRow = proxy.totalRow;
proxy.rowEnd = proxy.currentRow;
Expand All @@ -190,7 +190,8 @@ export async function createGroupForFirstScreen(
proxy.rowUpdatePos = proxy.rowEnd;
proxy.referenceRow = proxy.rowStart + Math.floor((proxy.rowEnd - proxy.rowStart) / 2);

proxy.currentCol = (bodyGroup.lastChild as Group)?.col ?? proxy.totalCol;
proxy.currentCol =
(bodyGroup.lastChild as Group)?.col ?? (colHeaderGroup.lastChild as Group)?.col ?? proxy.totalCol;
proxy.colEnd = proxy.currentCol;
proxy.colUpdatePos = proxy.colEnd;
proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2);
Expand Down
19 changes: 13 additions & 6 deletions packages/vtable/src/scenegraph/group-creater/progress/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class SceneProxy {
// 确定首屏高度范围
const widthLimit = this.table.tableNoFrameWidth * 5;
this.screenColCount = Math.ceil(this.table.tableNoFrameWidth / defaultColWidth);
this.firstScreenColLimit = this.bodyLeftCol + Math.ceil(widthLimit / defaultColWidth);
this.firstScreenColLimit = this.bodyLeftCol + Math.min(this.colLimit, Math.ceil(widthLimit / defaultColWidth));
// this.firstScreenRowLimit = this.bodyBottomRow;

this.colUpdatePos = this.bodyRightCol;
Expand Down Expand Up @@ -132,7 +132,7 @@ export class SceneProxy {
// 确定首屏高度范围
const heightLimit = this.table.tableNoFrameHeight * 5;
this.screenRowCount = Math.ceil(this.table.tableNoFrameHeight / defaultRowHeight);
this.firstScreenRowLimit = this.bodyTopRow + Math.ceil(heightLimit / defaultRowHeight);
this.firstScreenRowLimit = this.bodyTopRow + Math.min(this.rowLimit, Math.ceil(heightLimit / defaultRowHeight));
// this.firstScreenRowLimit = this.bodyBottomRow;

this.rowUpdatePos = this.bodyBottomRow;
Expand Down Expand Up @@ -363,11 +363,18 @@ export class SceneProxy {
);
}
// create colGroup
const lastColumnGroup = (
this.table.scenegraph.bodyGroup.lastChild instanceof Group
let lastColumnGroup =
this.table.scenegraph.bodyGroup.lastChild &&
((this.table.scenegraph.bodyGroup.lastChild instanceof Group
? this.table.scenegraph.bodyGroup.lastChild
: this.table.scenegraph.bodyGroup.lastChild._prev
) as Group;
: this.table.scenegraph.bodyGroup.lastChild._prev) as Group);
if (!lastColumnGroup) {
lastColumnGroup =
this.table.scenegraph.colHeaderGroup.lastChild &&
((this.table.scenegraph.colHeaderGroup.lastChild instanceof Group
? this.table.scenegraph.colHeaderGroup.lastChild
: this.table.scenegraph.colHeaderGroup.lastChild._prev) as Group);
}
const xOrigin = lastColumnGroup.attribute.x + lastColumnGroup.attribute.width;
const yOrigin = lastColumnGroup.attribute.y;
// create bodyGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ async function moveColumn(
direction
);

const colGroup = proxy.table.scenegraph.getColGroup(screenLeftCol);
const colGroup =
proxy.table.scenegraph.getColGroup(screenLeftCol) || proxy.table.scenegraph.getColGroup(screenLeftCol, true);
const deltaX =
screenLeftX - (colGroup.attribute.x + proxy.table.getFrozenColsWidth() + proxy.table.scenegraph.proxy.deltaX);
proxy.table.scenegraph.proxy.deltaX += deltaX;
Expand Down

0 comments on commit 62e39f4

Please sign in to comment.