Commit 2a72f59a authored by Nico Mack's avatar Nico Mack

Added new Constructor to SelectioGroup class.

Fixed a bug in ColorNuance behaviour.
parent ee493ab8
......@@ -895,7 +895,7 @@ public class BootstrappingUtils {
Element nuanceNode = (childName != null) ? rootElement.getChild(childName) : rootElement;
if (nuanceNode != null) {
nuance = new ColorNuance();
nuance.setAlpha(getContentAsNuance(nuanceNode, Externalization.ALPHA_NODE, BootstrappingUtils.OPTIONAL, 0d, context, NORMALIZED));
nuance.setAlpha(getContentAsNuance(nuanceNode, Externalization.ALPHA_NODE, BootstrappingUtils.OPTIONAL, -1d, context, NORMALIZED));
nuance.setHue(getContentAsNuance(nuanceNode, Externalization.HUE_NODE, BootstrappingUtils.OPTIONAL, 0d, context, NORMALIZED));
nuance.setSaturation(getContentAsNuance(nuanceNode, Externalization.SATURATION_NODE, BootstrappingUtils.OPTIONAL, 0d, context, NORMALIZED));
nuance.setBrightness(getContentAsNuance(nuanceNode, Externalization.BRIGHTNESS_NODE, BootstrappingUtils.OPTIONAL, 0d, context, NORMALIZED));
......
......@@ -126,7 +126,7 @@ public class ColorNuance {
// ---------------------------------------------------------------------------
public boolean affectsAlpha() {
return this.brightness != 0;
return this.alpha >= 0;
}
// ---------------------------------------------------------------------------
......@@ -264,14 +264,16 @@ public class ColorNuance {
}
if (affectsAlpha()) {
double normalizedAlpha = newAlpha;
normalizedAlpha *= 1 + this.alpha;
newAlpha = MathUtils.constrain((int) (normalizedAlpha), 0x00, 0xff);
// double normalizedAlpha = newAlpha;
// normalizedAlpha *= this.alpha;
newAlpha = (int) (255 * this.alpha);
newAlpha = MathUtils.constrain(newAlpha, 0x00, 0xff);
}
int rgb = Color.HSBtoRGB(hsb[HUE], hsb[SATURATION], hsb[BRIGHTNESS]);
rgb |= ((newAlpha << 24) & 0xFF000000);
return new Color(rgb);
rgb &= 0x00FFFFFF;
rgb |= (newAlpha << 24);
return new Color(rgb, true);
}
// ---------------------------------------------------------------------------
......
......@@ -66,6 +66,21 @@ public class SelectionGroup implements SelectionListener {
this.listeners = new ArrayList<>();
}
// ---------------------------------------------------------------------------
/**
* @param name
* @param isExclusive
*
*/
// ---------------------------------------------------------------------------
public SelectionGroup(String name, boolean isExclusive) {
this.name = name;
this.isExclusive = isExclusive;
this.members = new ArrayList<>();
this.listeners = new ArrayList<>();
}
// ---------------------------------------------------------------------------
/**
* @param rootElement
......@@ -206,6 +221,11 @@ public class SelectionGroup implements SelectionListener {
}
// ---------------------------------------------------------------------------
/**
* @param selectable
* @return
*/
// ---------------------------------------------------------------------------
public boolean add(Selectable selectable) {
if (!this.members.contains(selectable)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment