Skip to content

#2371: Not disabling scrollZoom when page (plot) has scroll bar #3085

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,6 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {

recomputeAxisLists();

// if the plot has scrollbars (more than a tiny excess)
// disable scrollzoom too.
if(pc.scrollHeight - pc.clientHeight > 10 ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. But the comment says if the *plot had scrollbars, not if the page has some.

Maybe we aren't using the correct DOM properties.

Copy link
Contributor

Choose a reason for hiding this comment

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

So in https://codepen.io/plotly/pen/QjKZbg,

on full-screen I got:

image

but after resize to half-screen-width, I get e.g.

image


So perhaps we should compare pc.scrollWidth with fullLayout.width and pc.scrollHeight with fullLayout.height to determine if scroll should be activated.

pc.scrollWidth - pc.clientWidth > 10) {
return;
}

clearTimeout(redrawTimer);

var wheelDelta = -e.deltaY;
Expand Down