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) { protected void setHSBHue(final double hue) {
hueHSB = hue; hueHSB = hue;
if (hueHSB < 0) hueHSB += 1.0;
} }
protected void setHSLHue(final double hue) { protected void setHSLHue(final double hue) {
hueHSL = hue; hueHSL = hue;
if (hueHSL < 0) hueHSL += 1.0;
} }
protected void setValue(final double value) { 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) { protected void setHSB(final double h, final double s, final double b) {
setHue(h); setHSBHue(h);
setHSBSaturation(s); setHSBSaturation(s);
setHSBValue(b); setHSBValue(b);
} }
@ -242,7 +244,7 @@ public class ColorTriangle extends JComponent {
} }
protected void setHSL(final double h, final double s, final double l) { protected void setHSL(final double h, final double s, final double l) {
setHue(h); setHSLHue(h);
setHSLSaturation(s); setHSLSaturation(s);
setHSLValue(l); setHSLValue(l);
} }
@ -317,6 +319,7 @@ public class ColorTriangle extends JComponent {
setHSL(h, s, l); setHSL(h, s, l);
color = DarkColorModelHSL.getColorFromHSLValues(h, s, l); color = DarkColorModelHSL.getColorFromHSLValues(h, s, l);
setHSB(DarkColorModelHSB.RGBtoHSBValues(color.getRed(), color.getGreen(), color.getBlue())); setHSB(DarkColorModelHSB.RGBtoHSBValues(color.getRed(), color.getGreen(), color.getBlue()));
setHSBHue(h);
rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2; rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2;
invalidateWheel(); invalidateWheel();
fireColorChanged(source); fireColorChanged(source);
@ -327,6 +330,7 @@ public class ColorTriangle extends JComponent {
setHSB(h, s, b); setHSB(h, s, b);
color = DarkColorModelHSB.getColorFromHSBValues(h, s, b); color = DarkColorModelHSB.getColorFromHSBValues(h, s, b);
setHSL(DarkColorModelHSL.RGBtoHSLValues(color.getRed(), color.getGreen(), color.getBlue())); setHSL(DarkColorModelHSL.RGBtoHSLValues(color.getRed(), color.getGreen(), color.getBlue()));
setHSLHue(h);
rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2; rotation = -(getHue() * 2 * Math.PI) + Math.PI / 2;
invalidateWheel(); invalidateWheel();
fireColorChanged(source); 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; JRootPane root = (JRootPane) parent;
if (root.getContentPane() != null) { if (root.getContentPane() != null) {
try { cpd = root.getContentPane().getPreferredSize();
cpd = root.getContentPane().getPreferredSize();
} catch (NullPointerException e) {
cpd = null;
System.out.println(Thread.currentThread());
}
} else { } else {
cpd = root.getSize(); cpd = root.getSize();
} }

Loading…
Cancel
Save