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

Scatter 3D dragmode turntable loses the camera.eye on JavaScript reload #6359

Open
halueda opened this issue Nov 4, 2022 · 4 comments
Open
Labels
bug something broken P3 backlog

Comments

@halueda
Copy link

halueda commented Nov 4, 2022

Scatter 3D dragmode "orbit" and "turntable" moves camera.eye but it is not reflected to layout.schene.camera.eye of the frame. It will be saved just after mouse click event or wheel, through relayoutCallback > scene.saveLayout .

scene.glplot.canvas.addEventListener('mouseup', function() {

If replot, react, animate and so on, happens during mouse move and mouse up, replot uses layout.schene.camera.eye saved BEFORE and overwrite.

It can reploduced in https://halueda.github.io/wavy-orbitals/ .
Its color is chaneged once a second and you can only rotate 3d-axis if mouse move is in 1 second, during color change.

To solve this, there seems two ways.

  1. every mouse move event do scene.saveLayout. It may cause performance impact.
  2. replot function do scene.saveLayout if the plot is 3d.

Perhaps more genral way should be used. For example, mouse moving event set into something like pending events and replot-api executes all pending events prior to real replot. As well as, scene.saveLayout clears the pending event.

This issue can be related to:
#5500
#5005
#5560

@tkntkn
Copy link

tkntkn commented Dec 29, 2022

+1.

3D scene (like scatter3d) does not preserve its layout when data is updated during user interaction (like dragging) even if uirevision is set to be constant. This makes it really hard to interact with the figure when it updates frequently.

I think it occurs not only with "orbit" and "turntable" but also with "zoom" and "pan".

Reproduce: https://codepen.io/tknx/pen/GRBZRyw

@halueda
Copy link
Author

halueda commented Jan 2, 2023

I found tentative quick hack to solve this, until this issue will be solved. My repository has been applied this.

Call saveLayout() just before Plotly.update(), like following code.

      const gd = document.getElementById(div);
      const fullLayout = gd._fullLayout;
      const scene = fullLayout.scene._scene;
      const layout = scene.graphDiv.layout;
      scene.saveLayout(layout);

      Plotly.update(div,[trace1],lay1);

@rodrigo-pena
Copy link

@halueda Is there an equivalent hack on plotly for Python?

@halueda
Copy link
Author

halueda commented Jul 1, 2024

Sorry, I don't know.

@gvwilson gvwilson self-assigned this Jul 12, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Scatter 3D dragmode turntable loose the camera.eye when a javascript reload, e.g. react, replot, animate. Scatter 3D dragmode turntable loses the camera.eye on JavaScript reload Aug 9, 2024
@gvwilson gvwilson added bug something broken P3 backlog labels Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

4 participants