diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 42001ccbc..b7a15804f 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -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"}] diff --git a/packages/react-vtable/package.json b/packages/react-vtable/package.json index 5733759e5..4fa80866f 100644 --- a/packages/react-vtable/package.json +++ b/packages/react-vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vtable", - "version": "0.17.3", + "version": "0.17.4", "description": "The react version of VTable", "keywords": [ "react", diff --git a/packages/vtable-editors/package.json b/packages/vtable-editors/package.json index ff340c683..a1aad247b 100644 --- a/packages/vtable-editors/package.json +++ b/packages/vtable-editors/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable-editors", - "version": "0.17.3", + "version": "0.17.4", "description": "", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/vtable-export/package.json b/packages/vtable-export/package.json index f62a6ac76..ae93e09f0 100644 --- a/packages/vtable-export/package.json +++ b/packages/vtable-export/package.json @@ -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", diff --git a/packages/vtable/CHANGELOG.json b/packages/vtable/CHANGELOG.json index a2396c53d..85879786e 100644 --- a/packages/vtable/CHANGELOG.json +++ b/packages/vtable/CHANGELOG.json @@ -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", diff --git a/packages/vtable/CHANGELOG.md b/packages/vtable/CHANGELOG.md index ef89a4e4f..468c5a774 100644 --- a/packages/vtable/CHANGELOG.md +++ b/packages/vtable/CHANGELOG.md @@ -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 diff --git a/packages/vtable/package.json b/packages/vtable/package.json index f9717d36b..3c5839353 100644 --- a/packages/vtable/package.json +++ b/packages/vtable/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vtable", - "version": "0.17.3", + "version": "0.17.4", "description": "canvas table width high performance", "keywords": [ "grid", diff --git a/packages/vtable/src/scenegraph/graphic/chart.ts b/packages/vtable/src/scenegraph/graphic/chart.ts index ba53d9066..c79447c1f 100644 --- a/packages/vtable/src/scenegraph/graphic/chart.ts +++ b/packages/vtable/src/scenegraph/graphic/chart.ts @@ -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, @@ -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; +}