fix: Enforce minimum buffer size on resize #4554
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Jira ticket 📘
https://cognitedata.atlassian.net/browse/
Description 📝
This change enforces a minimum buffer size of 1 pixel in both dimensions to ensure that if the canvas element is contained within a resizable element, it never ends up with a width or height of 0, which causes GL errors, e.g.:
[.WebGL-000012EC00717100] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete: Attachment has zero size.
How has this been tested? 🔍
I've tested this in situ on an application which has the canvas contained within a flexible container, which fills the available remaining space, and also on the Reveal example viewer. The issue arises when the canvas element gets shrunk down so that it's width or height end up at 0.
Test instructions ℹ️
If you modify the returned template at the end of the
Viewer.tsx
class, you can replicate this by expanding the resizable div to full width, the GL errors will be thrown in the console.With this fix no errors will be thrown.
Checklist ☑️