Kitware / vtk-js

Visualization Toolkit for the Web
https://kitware.github.io/vtk-js/
BSD 3-Clause "New" or "Revised" License
1.24k stars 380 forks source link

[Bug] IFullScreenRenderWindowInitialValues is missing `rootContainer` property #3116

Open josealvarez97 opened 2 months ago

josealvarez97 commented 2 months ago

Bug description

The example Using vtk.js with React has rootContainer as the property, and indeed, if one doesn't specify rootContainer (but something else like container), the example will not work well.

Steps to reproduce

But it was confusing because TypeScript complains that the IFullScreenRenderWindowInitialValues doesn't have the rootContainer property. It should have it, since the library source code actually expects it.

There's no rootContainer on next-app/node_modules/@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow.d.ts

image

Detailed Behavior

No response

Expected Behavior

But rootContainer is referenced multiple times in next-app/node_modules/@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow.js

image

Therefore, this is just a small TypeScript issue.

Environment

jourdain commented 2 months ago

The fullScreenRenderWindow was made to shorten examples code so we could focus on what that example was for and not setting the rendering stack.

The fullScreenRenderWindow aim to be full screen and therefore don't have a container by default. Of course we broke that rule to allow us to inject a container at construction. But either way, that fullScreenRenderWindow should not be used outside of examples.

finetjul commented 2 months ago

@jourdain should we modify the documentation https://kitware.github.io/vtk-js/docs/vtk_react.html to use a GenericRenderWindow instead of a FullScreenRenderWindow ?

josealvarez97 commented 2 months ago

Thank you for the insight @jourdain

Actually @finetjul , yesterday it was very hard to adapt this example to React https://kitware.github.io/vtk-js/examples/ManyRenderers.html

jourdain commented 2 months ago

Indeed the react example should not use FullScreenRenderWindow. Using the core VTK classes should be the way to go. For real react showcase, you can look at https://github.com/Kitware/react-vtk-js