ComposedElement initially sorts its elements and respects their elements' y position if both are Dropdowns

This commit is contained in:
CrushedPixel
2015-07-19 02:33:02 +02:00
parent 3299986e18
commit 5b167351b0

View File

@@ -14,6 +14,7 @@ public class ComposedElement implements GuiElement {
public ComposedElement(GuiElement...parts) {
this.parts = new ArrayList<GuiElement>(Arrays.asList(parts));
Collections.sort(this.parts, COMPOSED_ELEMENT_COMPARATOR);
}
public void addPart(GuiElement part) {
@@ -98,6 +99,10 @@ public class ComposedElement implements GuiElement {
Boolean d1 = o1 instanceof GuiDropdown;
Boolean d2 = o2 instanceof GuiDropdown;
if(d1 && d2) {
return -new Integer(((GuiDropdown)o1).yPosition).compareTo(((GuiDropdown)o2).yPosition);
}
return d1.compareTo(d2);
}