OHIF/VTKPlugin

Add debounced resize event handler

Opened this issue · 1 comments

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

Make one PR to OHIF/Viewer:

Make another PR to VTKPlugin:

  • Adds onResize which calls volumeViewer.resize()