Skip to content

Double click to zoom out alternates between ranges #6336

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

Open
Kurappu opened this issue Oct 5, 2022 · 3 comments
Open

Double click to zoom out alternates between ranges #6336

Kurappu opened this issue Oct 5, 2022 · 3 comments
Labels
bug something broken P3 backlog

Comments

@Kurappu
Copy link

Kurappu commented Oct 5, 2022

Double click to reset zoom when an axis range is specified causes the double click zoom out behavior to alternate between the specified range and fully zoomed out on subsequent double clicks.

Reproduction

  1. Create new plot with a trace using Plotly.newPlot
  2. Specify a layout where at least one axis has a range specified
  3. Double click to fully zoom out
  4. Double click again to zoom back in to the specified range

See: https://codepen.io/Kurappu/pen/jOxpMvj

Expected

Double clicking to zoom out multiple times should not alternate between zoom states (step 4 above should result in nothing happening)

Possibly related issues

#2957, which got merged with #2718
While they touch on few related points, they don't seem to mention anything about the alternating issue I'm experiencing.

@klausbreyer
Copy link

I am also confused about this behavior.

@geophpherie
Copy link

geophpherie commented Mar 14, 2023

Stumbled upon this while (I think) encountering the same / similar thing on the Python side. I'm curious if the doubleClick behavior is what you're referring to. I think the alternation between zoom states is by design - in that it will move between reset and autosize because reset+autosize is the default behavior. Looking at your codepen, you could modify it this way to see the different options. I'm wondering if reset is the behavior you're looking for? In that once you zoom in, a double click will reset it then do nothing else?

EDIT: Reading it through some more maybe you actually want just autosize?

// var config = {doubleClick: false}
var config = {doubleClick: 'reset'}
// var config = {doubleClick: 'autosize'}
// var config = {doubleClick: 'reset+autosize'}

Plotly.newPlot('myDiv', data, layout, config);
      /**
       * Double click interaction (false, 'reset', 'autosize' or 'reset+autosize')
       */
      doubleClick: PropTypes.oneOf([
          false,
          'reset',
          'autosize',
          'reset+autosize',
      ]),

@klausbreyer
Copy link

@jbeyer16 this solved our issue. Thank you very much!!

@gvwilson gvwilson self-assigned this Jul 5, 2024
@gvwilson gvwilson removed their assignment Aug 2, 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