Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfocus children in Group#clearChildren() #6423

Merged
merged 5 commits into from Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
@@ -1,6 +1,7 @@
[1.9.15]
- [BREAKING CHANGE] Requires Java 7 or above
- [BREAKING CHANGE] API Change: Scaling is now an object instead of an enum. This may change behavior when used with serialization.
- [BREAKING CHANGE] Group#clearChildren() now unfocuses the actors. Added Group#clearChildren(boolean unfocus) for when this isn't wanted. #6423
- Scene2d.ui: Added new ParticleEffectActor to use particle effects on Stage
- API addition: iOS: Added HdpiMode option to IOSApplicationConfiguration to allow users to set whether they want to work in logical or raw pixels (default logical).
- Fix for #6377 Gdx.net.openURI not working with targetSdk 30
Expand Down
11 changes: 10 additions & 1 deletion gdx/src/com/badlogic/gdx/scenes/scene2d/Group.java
Expand Up @@ -349,11 +349,20 @@ public Actor removeActorAt (int index, boolean unfocus) {
return actor;
}

/** Removes all actors from this group. */
/** Removes all actors from this group and unfocuses them. Calls {@link #clearChildren(boolean)} with true. */
public void clearChildren () {
clearChildren(true);
}

/** Removes all actors from this group. */
public void clearChildren (boolean unfocus) {
Actor[] actors = children.begin();
for (int i = 0, n = children.size; i < n; i++) {
Actor child = actors[i];
if (unfocus) {
Stage stage = getStage();
if (stage != null) stage.unfocus(child);
}
child.setStage(null);
child.setParent(null);
}
Expand Down