plotly / plotly/react-plotly.js

onRelayout does not work with scrollwheel zoom on 3d plots

Open
#319 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
138
Avg merge
3d 2h
Merged PRs (30d)
4

Description

When using the scroll wheel to zoom, onRelayout seems to output the tiniest initial change rather than the layout at the end of the event (as using Zoom mode and clicking/dragging does), meaning the event better reflects the camera before the action rather than after, e.g:

  1. zooming in one 'click' of the scroll wheel will output with event.scene.camera.eye.x = 1.2499999999999998, only a tiny change from the default of 1.25
  2. zooming in again will output with event.scene.camera.eye.x = 0.94622499477157, a change of ~0.3 inwards
  3. then zooming out will output with event.scene.camera.eye.x = 0.7210090673130023, a change of ~0.2 inwards, representing another zoom in rather than out, when in theory we should be back to the position we were in after 1 zoom in

Also, if you click on the plot, then use the scroll wheel to zoom, the onRelayout event will often (but not always) be {}

Example (interact with plot as above and see console logs): https://codesandbox.io/s/compassionate-sara-hl4k9m

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and reproduce scrollwheel zoom on the 3D plot while observing the onRelayout console output. Compare the emitted camera values for zooming in, zooming out, and clicking before scrolling; done means the event reflects the final camera state and is not unexpectedly empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.