Browse Source

REPORT-19464 【匹配移动端】TAB下菜单式图标优化2

research/11.0
Bruce.Deng 5 years ago
parent
commit
6e65fd6e0a
  1. 6
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

6
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -452,10 +452,10 @@ public class CustomIconPane extends BasicPane {
String path = jf.getSelectedFile().getAbsolutePath(); String path = jf.getSelectedFile().getAbsolutePath();
// 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(image.getWidth(null) >= 48 ? IconManager.MAXSTORAGE_ICONWIDTH : image.getWidth(null), BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH),
image.getHeight(null) >= 48 ? IconManager.MAXSTORAGE_ICONHEIGHT : image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics(); Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, image.getWidth(null) >= 48 ? IconManager.MAXSTORAGE_ICONWIDTH : image.getWidth(null), image.getHeight(null) >= 48 ? IconManager.MAXSTORAGE_ICONHEIGHT : image.getHeight(null), null); g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush(); bufferedImage.flush();
g2d.dispose(); g2d.dispose();
iconImage = bufferedImage; iconImage = bufferedImage;

Loading…
Cancel
Save