From 343d3f19c2303c80c508f6775267596d56414c82 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Wed, 3 Jan 2024 15:51:01 +0800 Subject: [PATCH] fix: add corner group clip --- .../group-contribution-render.ts | 28 +++++++++++++++++++ .../vtable/src/scenegraph/graphic/group.ts | 7 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts index c2bed9b3a..24af6fe6b 100644 --- a/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts +++ b/packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts @@ -800,6 +800,34 @@ export class ClipBodyGroupBeforeRenderContribution implements IGroupRenderContri const height = table.getBottomFrozenRowsHeight(); context.beginPath(); context.rect(x, y, width, height); + } else if ((group as Group).role === 'corner-header') { + const x = 0; + const y = 0; + const width = table.getFrozenColsWidth(); + const height = table.getFrozenRowsHeight(); + context.beginPath(); + context.rect(x, y, width, height); + } else if ((group as Group).role === 'corner-right-top-header') { + const x = 0; + const y = 0; + const width = table.getRightFrozenColsWidth(); + const height = table.getFrozenRowsHeight(); + context.beginPath(); + context.rect(x, y, width, height); + } else if ((group as Group).role === 'corner-right-bottom-header') { + const x = 0; + const y = 0; + const width = table.getRightFrozenColsWidth(); + const height = table.getBottomFrozenRowsHeight(); + context.beginPath(); + context.rect(x, y, width, height); + } else if ((group as Group).role === 'corner-left-bottom-header') { + const x = 0; + const y = 0; + const width = table.getFrozenColsWidth(); + const height = table.getBottomFrozenRowsHeight(); + context.beginPath(); + context.rect(x, y, width, height); } } } diff --git a/packages/vtable/src/scenegraph/graphic/group.ts b/packages/vtable/src/scenegraph/graphic/group.ts index 0f664bb29..8144f39e6 100644 --- a/packages/vtable/src/scenegraph/graphic/group.ts +++ b/packages/vtable/src/scenegraph/graphic/group.ts @@ -271,8 +271,13 @@ export class Group extends VRenderGroup { this.role === 'row-header' || this.role === 'col-header' || this.role === 'right-frozen' || - this.role === 'bottom-frozen' + this.role === 'bottom-frozen' || + this.role === 'corner-header' || + this.role === 'corner-right-top-header' || + this.role === 'corner-right-bottom-header' || + this.role === 'corner-left-bottom-header' ) { + // Infinity bounds for manual clip group this._AABBBounds.setValue(-Infinity, -Infinity, Infinity, Infinity); // 更新bounds之后需要设置父节点,否则tag丢失 this.parent && this.parent.addChildUpdateBoundTag();