Skip to content
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

fix: adjust canvas, not only off screen renderer on resize #279

Merged

Conversation

Ouwen
Copy link
Contributor

@Ouwen Ouwen commented Nov 4, 2022

Fix for #2947

@netlify
Copy link

netlify bot commented Nov 4, 2022

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit a22e2a5
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/6367015a9eb8920008a720e6
😎 Deploy Preview https://deploy-preview-279--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sedghi
Copy link
Member

sedghi commented Nov 4, 2022

Interesting,
So changing the canvas width and height will force a clear on it (https://www.w3.org/TR/2010/WD-html5-20100624/the-canvas-element.html#the-canvas-element)

When the [canvas](https://www.w3.org/TR/2010/WD-html5-20100624/the-canvas-element.html#the-canvas-element) element is created, and subsequently whenever the [width](https://www.w3.org/TR/2010/WD-html5-20100624/the-canvas-element.html#attr-canvas-width) and [height](https://www.w3.org/TR/2010/WD-html5-20100624/the-canvas-element.html#attr-canvas-height) attributes are set (whether to a new value or to the previous value), the bitmap and any associated contexts must be cleared back to their initial state and reinitialized with the newly specified coordinate space dimensions.

So I'm pretty sure in OHIF or consuming apps, collapsing the side panel would show a huge ugly white canvas for each viewport.

Have you tried it in OHIF while collapsing sidebars and see what happens?

@Ouwen
Copy link
Contributor Author

Ouwen commented Nov 4, 2022

Hmmmm, this wasn't the behavior I saw when resizing window. But I can try a side panel resize to see what happens. (chrome desktop)

@Ouwen
Copy link
Contributor Author

Ouwen commented Nov 5, 2022

Here is with and without resize videos:

OHIF Viewer without resize.webm
OHIF Viewer with resize.webm

@Ouwen Ouwen force-pushed the gradienthealth/fixed_render_resize branch from 327ef64 to a22e2a5 Compare November 6, 2022 00:35
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

I tested this and It works great. Thanks

@sedghi sedghi merged commit 1959ac7 into cornerstonejs:main Nov 17, 2022
NeilMacPhee pushed a commit to NeilMacPhee/cornerstone3D-beta that referenced this pull request Nov 22, 2022
@Ouwen Ouwen deleted the gradienthealth/fixed_render_resize branch December 16, 2022 09:59
wayfarer3130 pushed a commit that referenced this pull request Jan 20, 2023
* Experiment

Zero Copy Arrays

* Update ValueRepresentation.js

* Removed View
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.

2 participants