From 449d9aac76d796b8e6570ce7150be0225d67893a Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 4 Jul 2024 19:25:08 +0800 Subject: [PATCH 1/2] fix: fix fillhandle error in updateComponent() --- .../scenegraph/select/update-select-border.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/vtable/src/scenegraph/select/update-select-border.ts b/packages/vtable/src/scenegraph/select/update-select-border.ts index 1faa166a8..14d32b419 100644 --- a/packages/vtable/src/scenegraph/select/update-select-border.ts +++ b/packages/vtable/src/scenegraph/select/update-select-border.ts @@ -103,7 +103,7 @@ function updateComponent( visible: true }); if (selectComp.fillhandle) { - selectComp.fillhandle.setAttributes({ + selectComp.fillhandle?.setAttributes({ x: lastCellBound.x2 - scene.tableGroup.attribute.x - 3, // 调整小方块位置 y: lastCellBound.y2 - scene.tableGroup.attribute.y - 3, // 调整小方块位置 width: 6, @@ -210,7 +210,7 @@ function updateComponent( x: selectComp.rect.attribute.x + (table.getFrozenColsWidth() - selectComp.rect.attribute.x), width: width > 0 ? width : 0 }); - selectComp.fillhandle.setAttributes({ + selectComp.fillhandle?.setAttributes({ visible: width > 0 }); } @@ -226,7 +226,7 @@ function updateComponent( x: selectComp.rect.attribute.x, width: width > 0 ? width : 0 }); - selectComp.fillhandle.setAttributes({ + selectComp.fillhandle?.setAttributes({ visible: width - colsWidth > 0 }); } @@ -241,7 +241,7 @@ function updateComponent( y: selectComp.rect.attribute.y + (scene.colHeaderGroup.attribute.height - selectComp.rect.attribute.y), height: height > 0 ? height : 0 }); - selectComp.fillhandle.setAttributes({ + selectComp.fillhandle?.setAttributes({ visible: height > 0 }); } @@ -256,7 +256,7 @@ function updateComponent( y: selectComp.rect.attribute.y, height: height > 0 ? height : 0 }); - selectComp.fillhandle.setAttributes({ + selectComp.fillhandle?.setAttributes({ visible: height - rowsHeight > 0 }); } @@ -297,7 +297,7 @@ function updateComponent( selectComp.rect.setAttributes({ width: selectComp.rect.attribute.width - diffSize }); - // selectComp.fillhandle.setAttributes({ + // selectComp.fillhandle?.setAttributes({ // width: selectComp.rect.attribute.width - diffSize // }); } @@ -309,7 +309,7 @@ function updateComponent( x: selectComp.rect.attribute.x + diffSize, width: selectComp.rect.attribute.width - diffSize }); - // selectComp.fillhandle.setAttributes({ + // selectComp.fillhandle?.setAttributes({ // x: selectComp.rect.attribute.x + diffSize, // width: selectComp.rect.attribute.width - diffSize // }); @@ -321,7 +321,7 @@ function updateComponent( selectComp.rect.setAttributes({ height: selectComp.rect.attribute.height - diffSize }); - // selectComp.fillhandle.setAttributes({ + // selectComp.fillhandle?.setAttributes({ // height: selectComp.rect.attribute.height - diffSize // }); } @@ -333,7 +333,7 @@ function updateComponent( y: selectComp.rect.attribute.y + diffSize, height: selectComp.rect.attribute.height - diffSize }); - // selectComp.fillhandle.setAttributes({ + // selectComp.fillhandle?.setAttributes({ // y: selectComp.rect.attribute.y + diffSize, // height: selectComp.rect.attribute.height - diffSize // }); From d3be7579f6acbe1705da09f65798344205206494 Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Thu, 4 Jul 2024 20:02:51 +0800 Subject: [PATCH 2/2] fix: fix frozen select display --- .../vtable/src/scenegraph/select/update-select-border.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vtable/src/scenegraph/select/update-select-border.ts b/packages/vtable/src/scenegraph/select/update-select-border.ts index 14d32b419..1385309f9 100644 --- a/packages/vtable/src/scenegraph/select/update-select-border.ts +++ b/packages/vtable/src/scenegraph/select/update-select-border.ts @@ -114,7 +114,7 @@ function updateComponent( //#region 判断是不是按着表头部分的选中框 因为绘制层级的原因 线宽会被遮住一半,因此需要动态调整层级 let isNearRowHeader = table.frozenColCount ? startCol === table.frozenColCount : false; - if (!isNearRowHeader && table.frozenColCount && table.scrollLeft > 0) { + if (!isNearRowHeader && table.frozenColCount && table.scrollLeft > 0 && startCol >= table.frozenColCount) { const startColRelativePosition = table.getColsWidth(0, startCol - 1) - table.scrollLeft; if (startColRelativePosition < table.getFrozenColsWidth()) { isNearRowHeader = true; @@ -124,7 +124,7 @@ function updateComponent( let isNearRightRowHeader = table.rightFrozenColCount ? table.rightFrozenColCount > 0 && endCol === table.colCount - table.rightFrozenColCount - 1 : false; - if (!isNearRightRowHeader && table.rightFrozenColCount) { + if (!isNearRightRowHeader && table.rightFrozenColCount && endCol < table.colCount - table.rightFrozenColCount) { const endColRelativePosition = table.getColsWidth(0, endCol) - table.scrollLeft; if (endColRelativePosition > table.tableNoFrameWidth - table.getRightFrozenColsWidth()) { isNearRightRowHeader = true; @@ -132,7 +132,7 @@ function updateComponent( } let isNearColHeader = table.frozenRowCount ? startRow === table.frozenRowCount : true; - if (!isNearColHeader && table.frozenRowCount && table.scrollTop > 0) { + if (!isNearColHeader && table.frozenRowCount && table.scrollTop > 0 && startRow >= table.frozenRowCount) { const startRowRelativePosition = table.getRowsHeight(0, startRow - 1) - table.scrollTop; if (startRowRelativePosition < table.getFrozenRowsHeight()) { isNearColHeader = true; @@ -142,7 +142,7 @@ function updateComponent( let isNearBottomColHeader = table.bottomFrozenRowCount ? endRow === table.rowCount - table.bottomFrozenRowCount - 1 : false; - if (!isNearBottomColHeader && table.bottomFrozenRowCount) { + if (!isNearBottomColHeader && table.bottomFrozenRowCount && endRow < table.rowCount - table.bottomFrozenRowCount) { const endRowRelativePosition = table.getRowsHeight(0, endRow) - table.scrollTop; if (endRowRelativePosition > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight()) { isNearBottomColHeader = true;