Browse Source

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

Merge in DESIGN/design from ~STARRYI/design:release/10.0 to release/10.0

* commit '1951770b8e9a5d60c5381f1e3d2a0a3a15c406e6':
  REPORT-55497 【组件背景分离】组件复用-创建复用组件时,如果原组件超过规定尺寸,则复用组件缩小至规定尺寸且保持原比例。
zheng-1641779399395
starryi 3 years ago
parent
commit
207afbb822
  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