Browse Source

REPORT-55497 【组件背景分离】组件复用-创建复用组件时,如果原组件超过规定尺寸,则复用组件缩小至规定尺寸且保持原比例。

【问题原因】
生成复用组件时,需限制复用组件的尺寸
【改动思路】
zheng-1641779399395
Starryi 3 years ago
parent
commit
1951770b8e
  1. 17
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

17
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));
}
}
}
}

Loading…
Cancel
Save