From 1951770b8e9a5d60c5381f1e3d2a0a3a15c406e6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 20 Jul 2021 16:16:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55497=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E5=88=9B=E5=BB=BA=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=8E=9F?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=B6=85=E8=BF=87=E8=A7=84=E5=AE=9A=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=EF=BC=8C=E5=88=99=E5=A4=8D=E7=94=A8=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BC=A9=E5=B0=8F=E8=87=B3=E8=A7=84=E5=AE=9A=E5=B0=BA=E5=AF=B8?= =?UTF-8?q?=E4=B8=94=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=AF=94=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 生成复用组件时,需限制复用组件的尺寸 【改动思路】 --- .../share/ui/generate/ShareGeneratePane.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java index 93f07b260..99d6c556b 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java @@ -65,6 +65,8 @@ public class ShareGeneratePane extends BasicPane { private static final Dimension DIALOG_SIZE = new Dimension(670, 760); private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610); private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); + private static final double MAX_WIDTH = 500.0; + private static final double MAX_HEIGHT = 260.0; private JPanel mainPane = null; private ShareMainPane uploadPane = null; @@ -303,6 +305,7 @@ public class ShareGeneratePane extends BasicPane { } private DefaultSharableWidget transform(DefaultSharableWidget info) { + confineSize(info); //先屏蔽 //if (shareWidget instanceof AbstractBorderStyleWidget) { @@ -327,4 +330,18 @@ public class ShareGeneratePane extends BasicPane { } + private void confineSize(DefaultSharableWidget info) { + double width = info.getWidth(); + double height = info.getHeight(); + if (width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT)) { + double aspectRatio = width / height; + if (width / height > MAX_WIDTH / MAX_HEIGHT) { + info.setWidth((int) MAX_WIDTH); + info.setHeight((int) (MAX_WIDTH / aspectRatio)); + } else { + info.setHeight((int) MAX_HEIGHT); + info.setWidth((int) (MAX_HEIGHT * aspectRatio)); + } + } + } }