-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
#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
Conversation
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).
Thanks for the PR! I'm a little confused with some of the reports in #2371. Would you sharing an example of the situation you're trying to solve? |
Sure. The scrollToZoom/PinchToZoom is not working (tested on Windows and on Android) when the page is scrollable (the piece of code which I just removed disables it). You can mimic the behavior by opening e.g. the following page: https://codepen.io/plotly/pen/QjKZbg and after the plot is loaded you resize your window. Also when I've opened the issue I've linked an example (http://marfoldi.web.elte.hu/plotly) which contains multiple plots (if you have a kinda regular resolution there should be a scrollbar on page) and none of the plots are zoomable by scrolling (however all of them has the |
Thanks again for the PR and let me apologize for the delayed response (our 1.42.0 release cycle was a little hectic). I think I agree that from a pure plotly.js standpoint your patch does indeed fix a bug. As So, I'll suggest making the |
@@ -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 || |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
but after resize to half-screen-width, I get e.g.
So perhaps we should compare pc.scrollWidth
with fullLayout.width
and pc.scrollHeight
with fullLayout.height
to determine if scroll should be activated.
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).