From 4de95932548857b9d40d7540468bb7310356742d Mon Sep 17 00:00:00 2001 From: zhouping Date: Wed, 7 Dec 2016 20:56:09 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-1092=20=E4=B8=A4=E4=B8=AA=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=E7=9A=84=E8=A1=A8=E5=8D=95demo=EF=BC=8C=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E7=9A=84=E6=95=88=E6=9E=9C=E4=B8=8D=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XWAbsoluteLayout.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index df2875939..98e06ebac 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -96,7 +96,6 @@ public class XWAbsoluteLayout extends XLayoutContainer { if(screenValue != FormArea.DEFAULT_SLIDER){ this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); } - widget.setDesigningResolution(scrnsize); } /** @@ -208,7 +207,33 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } } - + + /** + * 更新子组件的Bound + * 这边主要用于绝对布局子组件在适应区域选项时 + * 涉及到的不同分辨率下缩放 + * @param minHeight 最小高度 + */ + @Override + public void updateChildBound(int minHeight) { + double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER; + if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) { + for (int i = 0; i < this.getComponentCount(); i++) { + XCreator creator = getXCreator(i); + Rectangle rec = new Rectangle(creator.getBounds()); + rec.x = (int)(rec.x / prevContainerPercent * containerPercent); + rec.y = (int)(rec.y / prevContainerPercent * containerPercent); + rec.height = (int)(rec.height / prevContainerPercent * containerPercent); + rec.width = (int)(rec.width / prevContainerPercent * containerPercent); + BoundsWidget wgt = toData().getBoundsWidget(creator.toData()); + wgt.setBounds(rec); + creator.setBounds(rec); + creator.updateChildBound(minHeight); + } + } + toData().setDesigningResolution(Toolkit.getDefaultToolkit().getScreenSize()); + } + /** * 增加对齐线 * @param connector 对齐线