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

Use ResizeObserver on DOM element #424

Merged
merged 1 commit into from
Jun 5, 2023

Conversation

sdrave
Copy link
Contributor

@sdrave sdrave commented Jun 5, 2023

Currently, K3D listens for browser window resize events. This causes issues when the DOM element into which K3D renders is resized for some reason while the browser window does not change its size. In particular, this often seems to be the case when when a K3D plot is placed into an ipywidgets container. By using a ResizeObserver on the targetDOMNode, this issue is avoided.

For example, on k3d-2.15.3 with

ipykernel==6.23.1
ipython==8.14.0
ipywidgets==8.0.6
jupyter-events==0.6.3
jupyter-lsp==2.2.0
jupyter_client==8.2.0
jupyter_core==5.3.0
jupyter_server==2.6.0
jupyter_server_terminals==0.4.4
jupyterlab==4.0.1
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.7
jupyterlab_server==2.22.1

I see the following issue:

k3d_mwe

With the proposed changes, the plot is correctly displayed.

@artur-trzesiok
Copy link
Collaborator

@sdrave I like that pull request! Thanks a lot!

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