From 35103ca69ce2d567c2af501eaef1c839accb47ed Mon Sep 17 00:00:00 2001 From: yulei Date: Wed, 21 Aug 2024 22:54:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E8=A1=8CminHeight=E6=9C=80=E5=A4=A7=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/core/draw/Draw.ts | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 6542891..b004543 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -1263,6 +1263,9 @@ export class Draw { } else if (element.type === ElementType.TABLE) { const tdPaddingWidth = tdPadding[1] + tdPadding[3] const tdPaddingHeight = tdPadding[0] + tdPadding[2] + const height = this.getHeight() + const marginHeight = this.getMainOuterHeight() + const emptyMainHeight = (height - marginHeight - rowMargin * 2) / scale // 表格分页处理进度:https://github.com/Hufe921/canvas-editor/issues/41 // 查看后续表格是否属于同一个源表格-存在即合并 if (element.pagingId) { @@ -1360,6 +1363,10 @@ export class Draw { const trList = element.trList! for (let t = 0; t < trList.length; t++) { const tr = trList[t] + // 检查行的minHeight,最大只能为页面主内容区域高度 + if (tr.minHeight && tr.minHeight > emptyMainHeight) { + tr.minHeight = emptyMainHeight + } for (let d = 0; d < tr.tdList.length; d++) { const td = tr.tdList[d] const rowList = this.computeRowList({ @@ -1422,20 +1429,6 @@ export class Draw { }) } } - // 检查行的minHeight,最大只能为页面主内容区域高度 - const height = this.getHeight() - const marginHeight = this.getMainOuterHeight() - const emptyMainHeight = (height - marginHeight - rowMargin * 2) / scale - trList.forEach(tr => { - if (tr.minHeight && tr.minHeight > emptyMainHeight) { - tr.height = emptyMainHeight - tr.minHeight = emptyMainHeight - tr.tdList.forEach(td => { - td.realHeight = emptyMainHeight - td.realMinHeight = emptyMainHeight - }) - } - }) // 需要重新计算表格内值 this.tableParticle.computeRowColInfo(element) // 计算出表格高度