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

feat: Component visibility (HasVisibility mixin) #2681

Merged
merged 11 commits into from Aug 26, 2023

Conversation

projectitis
Copy link
Contributor

Description

This PR introduces a new HasVisibility mixin on Component. It prevents the renderTree method from progressing if the isVisible property is false. It therefore prevents the component and all it's children from rendering.

The purpose of this mixin is to allow showing and hiding a component without removing it from the tree.

An important note is that the component (and all it's children) will still be on the tree. They will continue to receive update events, and all other lifecycle events. If the user has implemented input such as tap events, or collision detection, or any other interactivity, this will continue to operate without affect (unless it relies on the render step - such as per-pixel collision detection).

This is expected behaviour. If it is not desired, the user needs to account for it (by checking isVisible in their code) or someone needs to create another mixin for HasEnabled or HasActive which would prevent these other actions 馃榿

I am very happy to make changes, take suggestions, etc!

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #2669

@projectitis
Copy link
Contributor Author

Apologies for all the commits 馃檮

@spydon
Copy link
Member

spydon commented Aug 26, 2023

Apologies for all the commits 馃檮

Don't worry, they will all be squashed on merge

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, just one minor comment

doc/flame/components.md Outdated Show resolved Hide resolved
projectitis and others added 2 commits August 26, 2023 22:23
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
@spydon spydon merged commit 76405da into flame-engine:main Aug 26, 2023
7 checks passed
@projectitis projectitis deleted the 2669-feat-visibility branch August 26, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(component): Visibility support
2 participants