From 2380fc3f111ddac1e80f3ca6ed1252651f29a2d9 Mon Sep 17 00:00:00 2001 From: icezeros Date: Tue, 27 Jan 2026 18:12:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ix:=20#WIK-19521=20=E3=80=90aitable?= =?UTF-8?q?=E3=80=91=E6=8E=92=E6=9F=A5=EF=BC=9A=E7=82=B9=E5=87=BB=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=A0=BC=E5=8D=A1=E9=A1=BF=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renderer/components/cells/single-text.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/grid/src/renderer/components/cells/single-text.component.ts b/packages/grid/src/renderer/components/cells/single-text.component.ts index 44ffe781..605dae28 100644 --- a/packages/grid/src/renderer/components/cells/single-text.component.ts +++ b/packages/grid/src/renderer/components/cells/single-text.component.ts @@ -192,6 +192,15 @@ export class AITableCellText extends CoverCellBase { return; } const { height, data } = this.expandTextBounds(); + /** + * Konva.Text 中的 wrap 为 none 时,则不进行换行计算处理 + * Konva.Text 中的 wrap 为 char/word/word-break,并且设置了 width参数时,则会进行计算 根据宽度计算容纳的内容,超过后进行换行 + * Konva.Text 中的 ellipsis 为 true,并且 wrap为char/word/word-break,设置了width 和 height 参数,则会计算超过的部分进行截断,展示... + * 当 渲染的文字内容很多,开启上述运算时就会很耗时(实际是计算耗时,渲染并不耗时)。 + * 目前的优化方案: + * 计算与渲染分离,优先计算出换行的结果并对数据进行缓存。 + * 渲染时,根据提前计算的结果,使用 \n 拼装计算出的所有行,直接进行渲染。 + */ const textRender = data.map((item) => item.text).join('\n'); return { x,