Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Add debounced resize event handler #8

Open
swederik opened this issue Aug 20, 2018 · 1 comment
Open

Add debounced resize event handler #8

swederik opened this issue Aug 20, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@swederik
Copy link
Member

In OHIF we have a resize handler which is debounced to fire 100ms after resizing stops. This prevents needless re-computation / redraws while the browser is being resized (or the device is being rotated to a new orientation).

The VTK plugin should incorporate something similar. Somehow I think it makes more sense to implement this at the plugin level.

You can call volumeViewport.resize(), as is done here:

// TODO: VTK's canvas currently does not fill the viewport element
// after it has been resized. We need to set the height to 100% and
// trigger volumeViewer.resize() whenever things are resized.
// We might need to find a way to hook onto the OHIF Viewer ResizeManager
// div.querySelector('canvas').style.height = '100%';
volumeViewer.resize();

For reference: https://github.com/OHIF/Viewers/blob/master/Packages/ohif-viewerbase/client/lib/classes/ResizeViewportManager.js#L127

@swederik swederik added the enhancement New feature or request label Aug 20, 2018
@swederik swederik added this to the 1.0 milestone Aug 20, 2018
@swederik
Copy link
Member Author

Make one PR to OHIF/Viewer:

Make another PR to VTKPlugin:

  • Adds onResize which calls volumeViewer.resize()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants