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

Make scrollZoom config option a flaglist #3422

Merged
merged 5 commits into from Jan 16, 2019

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Jan 8, 2019

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
Copy link
Contributor Author

etpinard commented Jan 8, 2019

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

@alexcjohnson
Copy link
Contributor

Nice solution, I like it!

@etpinard
Copy link
Contributor Author

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

@archmoj
Copy link
Contributor

archmoj commented Jan 14, 2019

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

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

@archmoj archmoj left a comment

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.

src/plots/gl3d/camera.js Show resolved Hide resolved
test/jasmine/tests/config_test.js Show resolved Hide resolved
test/jasmine/tests/config_test.js Show resolved Hide resolved
src/plot_api/plot_api.js Show resolved Hide resolved
@archmoj
Copy link
Contributor

archmoj commented Jan 16, 2019

Thanks for the revision!
💃

@etpinard
Copy link
Contributor Author

No problem! Thank you for the review!

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

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
Contributor

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

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants