WorldWideTelescope / pywwt

Python interface to WorldWide Telescope :milky_way:
https://pywwt.readthedocs.io
BSD 3-Clause "New" or "Revised" License
51 stars 15 forks source link

Scroll-zoom interaction in notebook moves a *little bit* up/down the page #174

Open eteq opened 5 years ago

eteq commented 5 years ago

I see that #15 is almost the same thing and was closed over a year ago... But I was just playing with pywwt in Jupyter, and the problem still seems to be there. Curiously, it's a "slow" scroll - that is, not as fast if I do the same scrolling ouside the wwt widget. But it's still very gradually scrolling.

If it would be helpful/difficult to reproduce, I can try to record my screen and post it somewhere.

(This is in pywwt 0.5.2 on chrome on a Mac)

astrofrog commented 5 years ago

If this is annoying you can use the z/x keys to zoom. Normally it used to be fixed by ipyevents (developed by @mwcraig) but for some reason that fix no longer works.

mwcraig commented 5 years ago

I've been thinking about this and I don't entirely understand why this happens (thought it was simply because pywwt is in an iframe). While it is true we only see the scroll event in the widget getting passed up in an iframe, it isn't being passed straight through -- the scrolling is at a reduced rate (at least for a while).

I think the issue is not with the iframe per se; if you run the notebook in this gist which embeds an iframe with my department's web page in it, then when the mouse is in the red box, no scrolling happens, until you go over the iframe.

Over the iframe, scrolling changes the iframe contents, but not the containing page, until you hit the top or bottom of the page in the iframe. Then the scroll events are passed into the surrounding page, which starts to scroll.

A couple of take-aways:

Not sure how to make that magic happen, unfortunately.

Googling about preventing the body from scrolling hasn't turned up anything that actually seems to work for the notebook (the trick is supposed to be setting the body's overflow to hidden but that doesn't seem to affect the notebook).