question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[WIP] [Proposal] Return of the Stage

See original GitHub issue

Work In Progress

Leave your comments. The more people want it, the more time pixi team will look into it 😃

Also available here: https://github.com/pixijs/pixi.js/wiki/v5-Proposal%2C-Return-of-the-Stage

Problem

  1. Child has no way to know whether parent was removed from the stage.
  2. The Destroy API is horrible, we just ask people to maintain it on their side, but we dont give any tools to determine the moment object leaves the stage, and user has to implement refcounting on their side.
  3. There is no way to differentiate container from the root element, this flag is maintained by user.
  4. Recursive calls of add/remove complicates the stacktrace, and problems in remove/destroy appear too often, we cannot isolate them, user will see the mess anyway.

Possible problems with naive implementations:

  1. If we simply pass ‘added’ and ‘removed’ messages recursively it will affect performance when we construct difficult scene.
  2. Any simple manipulation within the stage, like moving an element from one subtree to another will fire those events and possibly trigger some destroy sequence.
  3. If we just add special flag in “removeChild” that won’t be good because people are having problems searching that flag in cocos2d engine, its not intuitive.
  4. Porting old code may be difficult if we force usage of the stage. We must ensure compatibility with old “container as root” approach.
  5. There might be cases with multiple stages inside each other. We have to resolve it somehow, stage needs to know about its parentStage.

Solution

  1. Put big sign for users DO NOT MODIFY children PROPERTY.
  2. Mark all display objects with UniqueID
  3. Stage is Container that must store all its children in set by their ID. Elements store a link to the stage they were added.
  4. If subtree is added/removed to the stage, fire added/removed event through whole subtree and re-assign stage field for all elements.
  5. Add detachChild method that does not fire removed but adds whole subtree to special stage’s detached set of elements, that can be removed on next frame, if user says so, or if special flag is enabled. Calling “addChild” on detached elements adds them back, without added signal/event.
  6. Add/remove/detach works like in pixi-v4 when there is no Stage parent. Allow free modification of children in that case.
  7. If the stage added inside another stage, it behaves as a single element: no recursive added/removed.
  8. All those manipulations must use BFS (queue) instead of recursion. It simplifies the debug process for users.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:22
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
englercjcommented, Jul 25, 2017

@PainKKKiller Please use the reactions to +1 rather than posting a +1 comment. Thanks!

0reactions
lock[bot]commented, Feb 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Successful Proposal - WIP HQ Event - YouTube
All-star Women In Product Conference 2020 speakers, Kalia Aragon (Product Manager, Disney Streaming Services), Jessica Cherny (Head of Data ...
Read more >
babel/proposals: ✍️ Tracking the status of Babel's ... - GitHub
This way everyone is moving towards Stage 4 and closer to what will be in the spec if the proposal makes it to...
Read more >
Proposal for Work In Progress (WIP) workflow - Google Git
Add a new property for unmerged changes called wip, for “work-in-progress” changes. A WIP change is a change that is not currently ready...
Read more >
Abstract submission - WIP 2022 - CongressLine
After you submit your proposal, you can still re-enter the submission link at any time to view and edit your Abstract until the...
Read more >
[WIP #6] - Wonderland Moderator Compensation
Objective: The objective of this proposal is to outline expectations, provide reasonable compensation to selected members of the moderation team ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found