Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into 819-feature-suppor…
Browse files Browse the repository at this point in the history
…t-edit-header
  • Loading branch information
fangsmile committed Jan 2, 2024
2 parents e7bcc44 + 8e39ba5 commit 2d7f26a
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 13 deletions.
2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.17.3","mainProject":"@visactor/vtable","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vtableMain","version":"0.17.4","mainProject":"@visactor/vtable","nextBump":"patch"}]
2 changes: 1 addition & 1 deletion packages/react-vtable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vtable",
"version": "0.17.3",
"version": "0.17.4",
"description": "The react version of VTable",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable-editors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vtable-editors",
"version": "0.17.3",
"version": "0.17.4",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable-export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vtable-export",
"version": "0.17.3",
"version": "0.17.4",
"description": "The export util of VTable",
"author": {
"name": "VisActor",
Expand Down
12 changes: 12 additions & 0 deletions packages/vtable/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@visactor/vtable",
"entries": [
{
"version": "0.17.4",
"tag": "@visactor/vtable_v0.17.4",
"date": "Tue, 02 Jan 2024 09:23:54 GMT",
"comments": {
"none": [
{
"comment": "fix: fix frozen chart cell active problem "
}
]
}
},
{
"version": "0.17.3",
"tag": "@visactor/vtable_v0.17.3",
Expand Down
9 changes: 8 additions & 1 deletion packages/vtable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @visactor/vtable

This log was last generated on Fri, 29 Dec 2023 12:31:07 GMT and should not be manually modified.
This log was last generated on Tue, 02 Jan 2024 09:23:54 GMT and should not be manually modified.

## 0.17.4
Tue, 02 Jan 2024 09:23:54 GMT

### Updates

- fix: fix frozen chart cell active problem

## 0.17.3
Fri, 29 Dec 2023 12:31:07 GMT
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vtable",
"version": "0.17.3",
"version": "0.17.4",
"description": "canvas table width high performance",
"keywords": [
"grid",
Expand Down
44 changes: 37 additions & 7 deletions packages/vtable/src/scenegraph/graphic/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,14 @@ export class Chart extends Group {
*/
activate(table: BaseTableAPI) {
this.active = true;
const { col, row } = this.parent;
// this.chart = new TestChart(this.attribute.spec);
// const ctx = this.attribute.canvas.getContext('2d');
// const { x1, y1, x2, y2 } = this.attribute.viewBox;
const { x1, y1, x2, y2 } = this.getViewBox();
//获取渲染区域的bound 考虑被表头遮住部分的情况
const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
const bodyBound = new Bounds();
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
const clipBound = bodyBound.intersect({
const tableBound = getTableBounds(col, row, table);
const clipBound = tableBound.intersect({
x1: x1 - table.scrollLeft,
x2: x2 - table.scrollLeft,
y1: y1 - table.scrollTop,
Expand Down Expand Up @@ -189,3 +185,37 @@ export class Chart extends Group {
};
}
}

function getTableBounds(col: number, row: number, table: BaseTableAPI) {
const { layoutMap } = table.internalProps;
const bodyBound = new Bounds();
const tableBound = table.scenegraph.tableGroup.globalAABBBounds;
bodyBound.x1 = tableBound.x1;
bodyBound.x2 = tableBound.x2;
bodyBound.y1 = tableBound.y1;
bodyBound.y2 = tableBound.y2;

if (!layoutMap.isFrozenColumn(col, row) && !layoutMap.isRightFrozenColumn(col, row)) {
// no frozen body
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
} else if (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightTopCorner(col, row)) {
// frozen cornor
} else if (layoutMap.isFrozenColumn(col, row)) {
// left frozen
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
} else if (layoutMap.isRightFrozenColumn(col, row)) {
// right frozen
bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();
bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();
} else if (layoutMap.isBottomFrozenRow(col, row)) {
// bottom frozen
bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
}

return bodyBound;
}

0 comments on commit 2d7f26a

Please sign in to comment.