pythreejs icon indicating copy to clipboard operation
pythreejs copied to clipboard

Autoresize Renderer

Open akaszynski opened this issue 3 years ago • 4 comments

First off, I'd like to thank the developers of this project. I've been able to make great strides plotting within jupyterlab and extending pyvista through pythreejs.

Is there any way to automatically resize the Renderer widget? This has been implemented in GanyJS: https://github.com/QuantStack/GanyJS/blob/08deb4b9689ebf03e5b09985feb6677fe25858d8/src/Scene.ts#L126-L138

I'm having issues building this locally in a "development version" (see #361). Would this be that hard to implement on your end? Otherwise, I'd like to contribute.

akaszynski avatar Jul 28 '21 05:07 akaszynski

@akaszynski Did you manage to get the local build working?

6A61736F6E206E61646572 avatar Oct 05 '21 05:10 6A61736F6E206E61646572

This should be possible to do, yes. You would need to listen for the lumino resize event (e.g. like this), and then trigger the auto-resize function. After measuring the dimensions, you would set the _height and _width traits on the renderer model from the JS side. I would probably recommend putting this behind a autoresize trait that controls whether this feature is active or not.

vidartf avatar Dec 06 '21 12:12 vidartf

Would this be that hard to implement on your end?

It isn't technically hard, but it is hard to put the time in for it.

vidartf avatar Dec 06 '21 12:12 vidartf

@akaszynski Did you manage to get the local build working?

Eventually, yes.

akaszynski avatar Apr 20 '22 15:04 akaszynski