Skip to content

Make scrollZoom config option a flaglist#3422

Merged
etpinard merged 5 commits into
config-opts-in-plot-schemafrom
scrollzoom-flaglist
Jan 16, 2019
Merged

Make scrollZoom config option a flaglist#3422
etpinard merged 5 commits into
config-opts-in-plot-schemafrom
scrollzoom-flaglist

Conversation

@etpinard

@etpinard etpinard commented Jan 8, 2019

Copy link
Copy Markdown
Contributor

An attempt at resolving #143 and #2998 as well as a similar issue-less problem for mapbox subplots.

In brief, this PR makes the config option scrollZoom a flaglist -- with flags for all subplots that support zooming via scroll -- instead of a boolean:

  • its default value now becomes gl3d+geo+mapbox (instead of false) as all three of these subplot types have scroll zoom enabled by default.
  • Setting scrollZoom:true enables scroll zoom for all subplots, which is equivalent to scrollZoom:'cartesian+gl3d+geo+mapbox'
  • Setting scrollZoom:false disables scroll zoom on all subplots, which should make a bunch of users 😄

@plotly/plotly_js what do you think?

@etpinard etpinard added this to the 1.44.0 milestone Jan 8, 2019
@etpinard

etpinard commented Jan 8, 2019

Copy link
Copy Markdown
Contributor Author

... to be merge into #3376 where I made use of the new plot_config option declarations.

@alexcjohnson

Copy link
Copy Markdown
Collaborator

Nice solution, I like it!

@etpinard

Copy link
Copy Markdown
Contributor Author

@archmoj would you mind taking a look at this one at some point this week?

@archmoj

archmoj commented Jan 14, 2019

Copy link
Copy Markdown
Contributor

@etpinard OK. That's interesting. I'll have a look.

@archmoj archmoj self-requested a review January 14, 2019 15:03

@archmoj archmoj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great arrangement. Thanks @etpinard.
Please find my comments below.

Comment thread src/plots/gl3d/camera.js
Comment thread test/jasmine/tests/config_test.js
Comment thread test/jasmine/tests/config_test.js
Comment thread src/plot_api/plot_api.js
@archmoj

archmoj commented Jan 16, 2019

Copy link
Copy Markdown
Contributor

Thanks for the revision!
💃

@etpinard

Copy link
Copy Markdown
Contributor Author

No problem! Thank you for the review!

Comment thread src/plots/gl3d/scene.js
Comment on lines +234 to +238
scene.glplot.canvas.addEventListener('wheel', function() {
if(gd._context._scrollZoom.gl3d) {
relayoutCallback(scene);
}
}, passiveSupported ? {passive: false} : false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've disabled scrollZoom in the plot config, but the mouse is still getting captured when scrolling by the canvas. Looks like it's because of the wheel event listener that's being registered here anyway. After I remove the wheel listener on scene element from chrome inspector, scrolling the page no longer gets captured by the canvas.

@etpinard, can we not add the listener at all if scrollzoom is disabled?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zfei thanks for the debugging. This comment is going to get lost here on a merged PR though, can you make a new issue for this? Or better yet a PR, looks like it's probably a pretty easy fix 😎

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alexcjohnson.

I've never touched the Plotly codebase and haven't set up my mind to go through the learning curve yet. 😉

Will just leave it as an issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants