Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix fillhandle error in updateComponent() #2044

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/vtable/src/scenegraph/select/update-select-border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -124,15 +124,15 @@ 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;
}
}

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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
});
}
Expand All @@ -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
});
}
Expand All @@ -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
});
}
Expand All @@ -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
});
}
Expand Down Expand Up @@ -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
// });
}
Expand All @@ -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
// });
Expand All @@ -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
// });
}
Expand All @@ -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
// });
Expand Down
Loading