Browse Source

Merge pull request #625 in BA/design from ~PLOUGH/design:release to release

* commit 'e596f2aca760cd2f7c700c00d603c7861aaa8571':
  REPORT-1096 取色板=》调整代码
  REPORT-1096 取色板=》修复在实时模式下,无法取消颜色拾取的问题
master
superman 8 years ago
parent
commit
c2149ba061
  1. 12
      designer_base/src/com/fr/design/style/color/ColorPicker.java
  2. 1
      designer_base/src/com/fr/design/style/color/ColorSelectBox.java

12
designer_base/src/com/fr/design/style/color/ColorPicker.java

@ -32,6 +32,7 @@ public class ColorPicker extends JDialog implements ActionListener
private ColorSelectable colorSelectable;
private Point mousePos; // 鼠标的绝对坐标
private Color colorToSet; // 暂存要设置的颜色值
private Color initColor; // 保存初始颜色。实时模式下,如果取消取色操作,则重设为初始颜色
private Boolean setColorRealTime; // 实时设定颜色值
@ -66,6 +67,7 @@ public class ColorPicker extends JDialog implements ActionListener
// 如果要求实时变化,确保先关闭弹窗,再截屏
// 主要针对"图案"选项卡中的"前景"、"背景"
if (this.setColorRealTime) {
initColor = colorSelectable.getColor();
colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗
try {
Thread.sleep(100); // 等待弹窗关闭
@ -110,10 +112,10 @@ public class ColorPicker extends JDialog implements ActionListener
validate(); // 更新所有子控件
}
public void pickComplete(Boolean setColor) {
public void pickComplete(Color color) {
timer.stop();
if (setColor) {
colorSelectable.setColor(colorToSet);
if (color != null) {
colorSelectable.setColor(color);
}
this.dispose();
}
@ -130,9 +132,9 @@ public class ColorPicker extends JDialog implements ActionListener
public void mousePressed(MouseEvent e)
{
if (e.getButton() == e.BUTTON1) { // 左键确定
pickComplete(true);
pickComplete(colorToSet);
} else {
pickComplete(false);
pickComplete(setColorRealTime ? initColor : null);
}
}
}

1
designer_base/src/com/fr/design/style/color/ColorSelectBox.java

@ -63,6 +63,7 @@ public class ColorSelectBox extends AbstractSelectBox<Color> implements UIObserv
fireDisplayComponent(ColorBackground.getInstance(color));
}
});
colorPane.setColor(color);
return colorPane;
}

Loading…
Cancel
Save