Browse Source

REPORT-82110 设计器取色bug

【问题原因】取色器ColorPicker取色是基于截屏后读取颜色的,因此需确保弹出框全部关闭后截屏。
【改动思路】1、取色前添加hidePopupMenu的操作 2、使用invokeLater确保异步任务执行完成后截屏 3、为避免REPORT-25645的macOS适配问题,新增hidePopupMenu4PickColor的方法
【Review建议】
release/11.0
levy 2 years ago
parent
commit
b9e8b5227a
  1. 11
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  2. 10
      designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java

11
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -70,13 +70,10 @@ public class ColorPicker extends JDialog implements ActionListener {
// 主要针对"图案"选项卡中的"前景"、"背景"
if (this.setColorRealTime) {
colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗
try {
Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
colorPickerPanel.captureScreen();
// REPORT-82110 确保关闭所有弹窗后截屏
SwingUtilities.invokeLater(() -> {
colorPickerPanel.captureScreen();
});
}
}

10
designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java

@ -153,12 +153,22 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
popupWin = null;
}
// 取色器取色时,隐藏弹出框,无需经过macOS的判断
public void hidePopupMenu4PickColor() {
if (popupWin != null) {
popupWin.setVisible(false);
}
popupWin = null;
}
private ColorControlWindow getColorControlWindow() {
//find parant.
if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(this.isCanBeNull(), UIToolbarColorButton.this) {
@Override
protected void colorChanged() {
hidePopupMenu4PickColor();
UIToolbarColorButton.this.setColor(this.getColor());
}

Loading…
Cancel
Save