From 0e7d4a92517a5a81753ceb9bbbe5a4757da86578 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 13 Jul 2021 18:43:32 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-54410:=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=BD=E9=AB=98=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BC=9A=E5=BD=B1=E5=93=8D=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E5=9D=97=E4=B8=AD=E7=BB=84=E4=BB=B6=E7=9A=84=E5=AE=BD=E9=AB=98?= =?UTF-8?q?=E5=92=8C=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 自适应布局下的绝对画布块,在缩放内部组件时的时机不对,导致绝对布局计算自己的 缩放比例时,实际计算的是: (currentHeight + GAP / 2) / backupHeight, 然后把这个比例用在了自己的子组件上,导致绝对画布块内部组件的尺寸缩放比例与 外界不一致 【改动思路】 在addCompInterval调用后,此时XWAbsolute.getBounds中年返回的尺寸 是不包含gap的,进行绝对画布块内部组件尺寸调整 --- .../fr/design/designer/creator/XWFitLayout.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 6d7aa5d9f..896cbe37c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -780,6 +780,17 @@ public class XWFitLayout extends XLayoutContainer { tabLayout.updateBoundsWidget(); } } + } + layout.setContainerHeight(containerHeight); + layout.setContainerWidth(containerWidth); + addCompInterval(getAcualInterval()); + + // REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置 + // 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的 + // 组件尺寸缩放比例会有问题 + for (int index = 0, n = this.getComponentCount(); index < n; index++) { + XCreator creator = (XCreator) this.getComponent(index); + BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); //如果子组件是绝对布局,则内部的widget也要更新 if (creator.acceptType(XWAbsoluteLayout.class)){ //更新的时候一定要带上backupBound @@ -790,9 +801,6 @@ public class XWFitLayout extends XLayoutContainer { creator.setBackupBound(creator.getBounds()); } } - layout.setContainerHeight(containerHeight); - layout.setContainerWidth(containerWidth); - addCompInterval(getAcualInterval()); } private Rectangle recalculateWidgetBounds(Rectangle rec, int[] hors, int[] veris) {