feat: canvas readiness#192
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #192 +/- ##
==========================================
+ Coverage 99.14% 99.23% +0.09%
==========================================
Files 135 135
Lines 7123 7313 +190
Branches 1623 1686 +63
==========================================
+ Hits 7062 7257 +195
+ Misses 61 56 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7ef57cc to
9c333ec
Compare
| return setInterval(() => { | ||
| if (canvas.parentElement) { | ||
| observeParent(canvas.parentElement); | ||
| } | ||
| }, 16); |
There was a problem hiding this comment.
Hey. Just a question. Why do we have this separate interval in here?
Would it be possible to check if we are still observing the right parent, before every frame instead, so we do it in the requestAnimationFrame loop we already have.
Also instead of having a resize observer, and checking regularly if the observed parent is still the actual parent. Could we not just directly check every frame if the dimensions have changed instead? Or am i missing something?
afcf0d0 to
0ef2bb2
Compare
1. Why is this change necessary?
The current implementation can lead to unrecovarable canvas states where webgpu/webgl cannot be initialized by dive.
2. What does this change do, exactly?
Introduce a proper canvas lifecycle manager class that watches over the canvas' readiness.