mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-18 01:46:11 +00:00
merge color with parent
This commit is contained in:
parent
1a5e8c395a
commit
2061035bc6
@ -35,29 +35,33 @@ public class Caption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TextColor lastColor = parent.color();
|
||||||
List<Component> children = parent.children();
|
List<Component> children = parent.children();
|
||||||
if (!children.isEmpty()) {
|
if (!children.isEmpty()) {
|
||||||
TextColor lastColor = parent.color();
|
|
||||||
for (int i = 0; i < children.size(); i++) {
|
for (int i = 0; i < children.size(); i++) {
|
||||||
Component child = children.get(i);
|
Component original = children.get(i);
|
||||||
Component coloredChild = color(child);
|
Component child = original;
|
||||||
if (coloredChild.color() == null && lastColor != null) {
|
if (child.color() == null && lastColor != null) {
|
||||||
coloredChild = coloredChild.color(lastColor);
|
child = child.color(lastColor);
|
||||||
}
|
}
|
||||||
if (coloredChild != child) {
|
child = color(child);
|
||||||
|
if (original != child) {
|
||||||
if (!(children instanceof ArrayList)) {
|
if (!(children instanceof ArrayList)) {
|
||||||
children = new ArrayList<>(children);
|
children = new ArrayList<>(children);
|
||||||
}
|
}
|
||||||
children.set(i, coloredChild);
|
children.set(i, child);
|
||||||
}
|
}
|
||||||
if (coloredChild.color() != null) {
|
if (child.color() != null) {
|
||||||
lastColor = coloredChild.color();
|
lastColor = child.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (children instanceof ArrayList) {
|
if (children instanceof ArrayList) {
|
||||||
parent = parent.children(children);
|
parent = parent.children(children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (parent.color() == null && lastColor != null) {
|
||||||
|
parent = parent.color(lastColor);
|
||||||
|
}
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user