Browse Source

Merge pull request #942 in BA/design from ~XIAOXIA/design:9.0 to 9.0

* commit '6f72fa5fdb82b488c1be52b33567e5b9ff71dfea':
  bug fix
  代码质量,修改缩放
master
superman 7 years ago
parent
commit
89b459d844
  1. 15
      designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java
  2. 2
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

15
designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java

@ -1,22 +1,25 @@
package com.fr.design.mainframe.alphafine.preview;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
/**
* Created by XiaXiang on 2017/5/2.
*/
public class FilePreviewPane extends JPanel {
public FilePreviewPane(Image image) {
public FilePreviewPane(BufferedImage image) {
setLayout(new BorderLayout());
UILabel label = new UILabel();
label.setOpaque(true);
label.setBackground(Color.white);
float scale = image.getWidth(null) / 380;
image = image.getScaledInstance(380, (int) (image.getHeight(null) / scale), Image.SCALE_SMOOTH);
label.setIcon(new ImageIcon(image));
float widthScale = (AlphaFineConstants.RIGHT_WIDTH) / (float) image.getWidth();
float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight();
Image showImage;
showImage = widthScale > heightScale? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH);
label.setIcon(new ImageIcon(showImage));
add(label);
}
}

2
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -149,7 +149,7 @@ public class AlphaFineConfigManager implements XMLable {
* @return
*/
private String getDefaultShortCuts() {
return OperatingSystem.isMacOS()? "meta + F" : "ctrl + F";
return OperatingSystem.isMacOS()? "meta + D" : "ctrl + D";
}
public void setShortcuts(String shortcuts) {

Loading…
Cancel
Save