Browse Source

Fixed color wheel not updating hue.

pull/130/head
weisj 5 years ago
parent
commit
0dc86e4c0c
  1. 8
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorTriangle.java
  2. 7
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java

8
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorTriangle.java

@ -168,10 +168,12 @@ public class ColorTriangle extends JComponent {
protected void setHSBHue(final double hue) {
hueHSB = hue;
if (hueHSB < 0) hueHSB += 1.0;
}
protected void setHSLHue(final double hue) {
hueHSL = hue;
if (hueHSL < 0) hueHSL += 1.0;
}
protected void setValue(final double value) {
@ -232,7 +234,7 @@ public class ColorTriangle extends JComponent {
}
protected void setHSB(final double h, final double s, final double b) {
setHue(h);
setHSBHue(h);
setHSBSaturation(s);
setHSBValue(b);
}
@ -242,7 +244,7 @@ public class ColorTriangle extends JComponent {
}
protected void setHSL(final double h, final double s, final double l) {
setHue(h);
setHSLHue(h);
setHSLSaturation(s);
setHSLValue(l);
}
@ -317,6 +319,7 @@ public class ColorTriangle extends JComponent {
setHSL(h, s, l);
color = DarkColorModelHSL.getColorFromHSLValues(h, s, l);
setHSB(DarkColorModelHSB.RGBtoHSBValues(color.getRed(), color.getGreen(), color.getBlue()));
setHSBHue(h);
rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2;
invalidateWheel();
fireColorChanged(source);
@ -327,6 +330,7 @@ public class ColorTriangle extends JComponent {
setHSB(h, s, b);
color = DarkColorModelHSB.getColorFromHSBValues(h, s, b);
setHSL(DarkColorModelHSL.RGBtoHSLValues(color.getRed(), color.getGreen(), color.getBlue()));
setHSLHue(h);
rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2;
invalidateWheel();
fireColorChanged(source);

7
core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java

@ -68,12 +68,7 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
JRootPane root = (JRootPane) parent;
if (root.getContentPane() != null) {
try {
cpd = root.getContentPane().getPreferredSize();
} catch (NullPointerException e) {
cpd = null;
System.out.println(Thread.currentThread());
}
cpd = root.getContentPane().getPreferredSize();
} else {
cpd = root.getSize();
}

Loading…
Cancel
Save