From 3fe8430fb109fe5941c097690a4efb793094dedc Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Tue, 11 Jun 2024 16:30:29 +0800 Subject: [PATCH] fix: fix ellipsis error in _disableColumnAndRowSizeRound mode #1884 --- .../vtable/fix-ellipsis_2024-06-11-08-30.json | 10 ++++++++++ .../vtable/src/scenegraph/group-creater/cell-helper.ts | 2 +- .../group-creater/cell-type/checkbox-cell.ts | 2 +- .../scenegraph/group-creater/cell-type/radio-cell.ts | 2 +- .../vtable/src/scenegraph/utils/text-icon-layout.ts | 6 +++--- 5 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 common/changes/@visactor/vtable/fix-ellipsis_2024-06-11-08-30.json diff --git a/common/changes/@visactor/vtable/fix-ellipsis_2024-06-11-08-30.json b/common/changes/@visactor/vtable/fix-ellipsis_2024-06-11-08-30.json new file mode 100644 index 000000000..c6469cb6e --- /dev/null +++ b/common/changes/@visactor/vtable/fix-ellipsis_2024-06-11-08-30.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix ellipsis error in _disableColumnAndRowSizeRound mode #1884", + "type": "none" + } + ], + "packageName": "@visactor/vtable" +} \ No newline at end of file diff --git a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts index fd703ab26..9ad30d1bd 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -500,7 +500,7 @@ export function updateCell(col: number, row: number, table: BaseTableAPI, addNew lineClamp, wordBreak: 'break-word', // widthLimit: autoColWidth ? -1 : colWidth - (padding[1] + padding[3]), - heightLimit: cellHeight - (padding[0] + padding[2]), + heightLimit: cellHeight - Math.floor(padding[0] + padding[2]), pickable: false, dx: textAlign === 'left' ? hierarchyOffset : 0, x diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts index f3b15e7bd..6e7c77ca5 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/checkbox-cell.ts @@ -191,7 +191,7 @@ function createCheckbox( lineClamp, wordBreak: 'break-word', // widthLimit: autoColWidth ? -1 : colWidth - (padding[1] + padding[3]), - heightLimit: autoRowHeight ? -1 : cellHeight - (padding[0] + padding[2]), + heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]), pickable: false, dx: hierarchyOffset, whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal' diff --git a/packages/vtable/src/scenegraph/group-creater/cell-type/radio-cell.ts b/packages/vtable/src/scenegraph/group-creater/cell-type/radio-cell.ts index 86aaf777c..eb30a4449 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-type/radio-cell.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-type/radio-cell.ts @@ -160,7 +160,7 @@ function createRadio( lineClamp, wordBreak: 'break-word', // widthLimit: autoColWidth ? -1 : colWidth - (padding[1] + padding[3]), - heightLimit: autoRowHeight ? -1 : cellHeight - (padding[0] + padding[2]), + heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]), pickable: false, dx: hierarchyOffset // whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal' diff --git a/packages/vtable/src/scenegraph/utils/text-icon-layout.ts b/packages/vtable/src/scenegraph/utils/text-icon-layout.ts index dd5d83ca5..52de56b56 100644 --- a/packages/vtable/src/scenegraph/utils/text-icon-layout.ts +++ b/packages/vtable/src/scenegraph/utils/text-icon-layout.ts @@ -103,7 +103,7 @@ export function createCellContent( heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable ? -1 - : cellHeight - (padding[0] + padding[2]), + : cellHeight - Math.floor(padding[0] + padding[2]), pickable: false, dx: (textAlign === 'left' ? hierarchyOffset : 0) + _contentOffset, whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal' @@ -221,7 +221,7 @@ export function createCellContent( heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable ? -1 - : cellHeight - (padding[0] + padding[2]), + : cellHeight - Math.floor(padding[0] + padding[2]), pickable: false, autoWrapText, lineClamp, @@ -673,7 +673,7 @@ export function updateCellContentHeight( textAlign: CanvasTextAlign, textBaseline: CanvasTextBaseline ) { - const newHeight = distHeight - (padding[0] + padding[2]); + const newHeight = distHeight - Math.floor(padding[0] + padding[2]); const textMark = cellGroup.getChildByName('text');