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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SpriteText size not being computer when set to empty #1548

merged 6 commits into from May 10, 2018


Copy link

@smoogipoo smoogipoo commented May 10, 2018

When a SpriteText's text becomes string.Empty, it will become !IsPresent, and will:

  1. Not clear its children
  2. Not alert parents of this presence change.

This fixes both of those.

@smoogipoo smoogipoo added the bug label May 10, 2018
@smoogipoo smoogipoo added this to the May 2018 milestone May 10, 2018
@@ -38,7 +38,7 @@ public class SpriteText : FillFlowContainer, IHasCurrentValue<string>, IHasLineB
/// </summary>
public bool UseFullGlyphHeight = true;

public override bool IsPresent => base.IsPresent && !string.IsNullOrEmpty(text);
public override bool IsPresent => base.IsPresent && (!layout.IsValid || !string.IsNullOrEmpty(text));

This comment has been minimized.


peppy May 10, 2018

nitpick, but i think the empty check should come first as it's the predominant case

peppy approved these changes May 10, 2018
@peppy peppy merged commit af03b4a into ppy:master May 10, 2018
1 check passed
1 check passed
continuous-integration/appveyor/pr AppVeyor build succeeded
@smoogipoo smoogipoo deleted the smoogipoo:spritetext-clear-fix branch Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants