Skip to content
New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Option to add child at First position to ViewComponent #1362

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

DeathPhoenix22
Copy link
Contributor

Hi @AlmasB,

Add the possibility to add child to ViewComponent Last vs First.

No change to default behavior.
Reference: #1361

Copy link
Owner

@AlmasB AlmasB left a comment

Choose a reason for hiding this comment

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

Thanks, please see below

@@ -214,7 +221,11 @@ class ViewComponent : Component() {
}
}

group.children += child
if(addLast) {
Copy link
Owner

Choose a reason for hiding this comment

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

addLast is currently being used to add groups to parent -- in-game groups go first, developer groups go last, so we cannot use it to manage group children.

Perhaps we can generalise this to something like addChild(index: Int, node: Node, isTransformApplied: Boolean) with the default implementation being just addChild(node: Node, isTransformApplied: Boolean) which adds it last.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.57%. Comparing base (bb60463) to head (b1d9ecf).
Report is 53 commits behind head on dev.

Files with missing lines Patch % Lines
...com/almasb/fxgl/entity/components/ViewComponent.kt 66.66% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #1362      +/-   ##
============================================
- Coverage     59.63%   59.57%   -0.06%     
- Complexity     2975     3026      +51     
============================================
  Files           310      320      +10     
  Lines         15310    15468     +158     
  Branches       1562     1583      +21     
============================================
+ Hits           9130     9215      +85     
- Misses         5657     5730      +73     
  Partials        523      523              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants