From ad3c2baf970debddd8bf1b6de31982f6137dca7f Mon Sep 17 00:00:00 2001 From: Rui-Sun Date: Mon, 2 Dec 2024 20:11:47 +0800 Subject: [PATCH] fix: fix strokeArrayWidth update in updateCell() #2811 --- .../fix-strokeArrayWidth-update_2024-12-02-12-11.json | 10 ++++++++++ .../vtable/src/scenegraph/group-creater/cell-helper.ts | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vtable/fix-strokeArrayWidth-update_2024-12-02-12-11.json diff --git a/common/changes/@visactor/vtable/fix-strokeArrayWidth-update_2024-12-02-12-11.json b/common/changes/@visactor/vtable/fix-strokeArrayWidth-update_2024-12-02-12-11.json new file mode 100644 index 000000000..0c349dc49 --- /dev/null +++ b/common/changes/@visactor/vtable/fix-strokeArrayWidth-update_2024-12-02-12-11.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vtable", + "comment": "fix: fix strokeArrayWidth update in updateCell() #2811", + "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 5623cc9c7..e3a6b0a0e 100644 --- a/packages/vtable/src/scenegraph/group-creater/cell-helper.ts +++ b/packages/vtable/src/scenegraph/group-creater/cell-helper.ts @@ -37,6 +37,7 @@ import { isArray, isValid } from '@visactor/vutils'; import { breakString } from '../utils/break-string'; import type { CreateRadioCellGroup } from './cell-type/radio-cell'; import { onBeforeAttributeUpdateForInvertHighlight } from '../../plugins/invert-highlight'; +import { getCellBorderStrokeWidth } from '../utils/cell-border-stroke-width'; export function createCell( type: ColumnTypeOption, @@ -527,6 +528,8 @@ export function updateCell( // update group const cellWidth = table.getColWidth(col); const cellHeight = table.getRowHeight(row); + const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table); + oldCellGroup.setAttributes({ width: cellWidth, height: cellHeight, @@ -534,7 +537,7 @@ export function updateCell( lineWidth: cellTheme?.group?.lineWidth ?? undefined, fill: cellTheme?.group?.fill ?? undefined, stroke: cellTheme?.group?.stroke ?? undefined, - strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined, + strokeArrayWidth: strokeArrayWidth ?? undefined, strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined, cursor: (cellTheme?.group as any)?.cursor ?? undefined, cornerRadius: cellTheme?.group?.cornerRadius ?? 0,