Skip to content

Fix re-sorting to prevent single-frame blips of incorrect sort #133

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

Merged
merged 3 commits into from
Mar 20, 2022

Conversation

anderoonies
Copy link
Contributor

Summary

As a performance optimization, re-sorting the element pool as a result of a layer change or element removal was performed at the same time as a redraw. This could result in a single frame with out-of-order graphics.
This library doesn't aim to be the most performant, and keeping with expectations is better, so resorting will now happen prior to drawing if 1) an element has been added 2) an element has been removed 3) an element has had its layer changed.

Changes:

  • Keep track of sort invalidation on Graphics manager, which is updated when an element is added
  • Sort the element pool before drawing when necessary
  • Tests

Checklist

  • npm test passes
  • Unit tests are included / updated
  • Documentation has been updated where relevant

@anderoonies anderoonies merged commit 2ceb860 into codehs:main Mar 20, 2022
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.

1 participant