Skip to content

Do not disable scrollZoom scroll{Width,Height} > client{Width,Height} #3424

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

Merged
merged 6 commits into from
Jan 16, 2019

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Jan 9, 2019

fixes #2371 and #3337 by including a commit from @marfoldi's #3085.

Removing the scroll{Width,Height} > client{Width,Height} early return fixes two bugs:

There are probably other ways to fix these bugs, but that scroll{Width,Height} > client{Width,Height} early return feels out-of-place. It's probably a relic from the workspace days, where we set scrollZoom:true, but wanted some extra do-not-scroll logic. As scroll zoom is disable by default for cartesian subplots, I don't think overriding a scrollZoom: true user config is a good idea.

I hope @plotly/plotly_js agrees. If so, I'll add a few tests.

marfoldi and others added 3 commits October 9, 2018 12:01
Used to disable scrollzoom when the plot had scrollbars. Ended up with a plot which is not zoomable with mouse scroll on a page which had additional content (had a scrollbar).
@etpinard
Copy link
Contributor Author

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

@etpinard
Copy link
Contributor Author

Oh wait. I still have to add a few tests for this one.

Asking for @alexcjohnson 's opinion on this potentially-controversial patch.

@alexcjohnson
Copy link
Collaborator

Agreed. Explicit is better than implicit.

@etpinard
Copy link
Contributor Author

etpinard commented Jan 15, 2019

Oh wait. I still have to add a few tests for this one.

Done in 3ee0798 and 09e0a5d


@antoinerg I know you're busy, but would you mind taking a 👁️ at this PR at some point this week (should be quick 😉 )

if(pc.scrollHeight - pc.clientHeight > 10 ||
pc.scrollWidth - pc.clientWidth > 10) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure what this early return was meant to achieve but I guess it's OK to 🔪 considering it doesn't have any associated tests...

@antoinerg
Copy link
Contributor

Thank you for the fix @etpinard! It seems to work well: https://codepen.io/anon/pen/roRdmB

If the removed code really is a relic, then 💃

@etpinard etpinard merged commit 7d67f80 into master Jan 16, 2019
@etpinard etpinard deleted the scrollzoom-patch branch January 16, 2019 02:30
@alexcjohnson alexcjohnson mentioned this pull request Jan 16, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

responsive: true breaks scrollZoom: true scrollZoom no longer works when page is scrollable
4 participants