plotly / dash-bio

Open-source bioinformatics components for Dash
https://dash-gallery.plotly.host/Portal/?search=Bioinformatics
MIT License
531 stars 191 forks source link

Browser scrolls and zooms simultaniously NglMoleculeViewer #711

Open Ento0n opened 1 year ago

Ento0n commented 1 year ago

I am talking about the dash_bio.NglMolecule.Viewer here:

The browser is scrolling down when the mouse is in the window of the viewer, therefore the browser scrolls simultaniously when zooming into or out of the viewer.

I was told by the original developer that this could be an easy fix by overwriting the stage.mouseControls of the core ngl viewer.

Can you guys help me with this ?

Python version is: 3.10.4

These are the used dependencies: aiohttp 3.8.3 aiosignal 1.2.0 ansi2html 1.8.0 appnope 0.1.3 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 asttokens 2.0.5 async-timeout 4.0.2 attrs 21.4.0 backcall 0.2.0 beautifulsoup4 4.11.1 biopython 1.79 black 22.8.0 bleach 5.0.0 bokeh 2.4.3 Brotli 1.0.9 certifi 2022.5.18.1 cffi 1.15.0 charset-normalizer 2.0.12 click 8.1.3 cloudpickle 2.1.0 colorcet 3.0.0 colour 0.1.5 cycler 0.11.0 dash 2.6.1 dash-bio 1.0.2 dash-bootstrap-components 1.2.1 dash-core-components 2.0.0 dash-html-components 2.0.0 dash-table 5.0.0 dask 2022.6.0 datashader 0.14.0 datashape 0.5.2 debugpy 1.6.0 decorator 5.1.1 defusedxml 0.7.1 distributed 2022.6.0 docker-pycreds 0.4.0 entrypoints 0.4 executing 0.8.3 fastjsonschema 2.15.3 Flask 2.2.2 Flask-Compress 1.12 fonttools 4.33.3 frozenlist 1.3.1 fsspec 2022.5.0 GEOparse 2.0.3 gitdb 4.0.9 GitPython 3.1.27 h5py 3.7.0 HeapDict 1.0.1 holoviews 1.14.9 idna 3.3 imageio 2.19.3 ipykernel 6.15.0 ipython 8.4.0 ipython-genutils 0.2.0 ipywidgets 7.7.0 itsdangerous 2.1.2 jedi 0.18.1 Jinja2 3.1.2 joblib 1.1.0 jsonschema 4.6.0 jupyter 1.0.0 jupyter-client 7.3.4 jupyter-console 6.4.3 jupyter-core 4.10.0 jupyter-dash 0.4.2 jupyterlab-pygments 0.2.2 jupyterlab-widgets 1.1.0 kaleido 0.2.1 kiwisolver 1.4.3 llvmlite 0.38.1 locket 1.0.0 Markdown 3.3.7 MarkupSafe 2.1.1 matplotlib 3.5.2 matplotlib-inline 0.1.3 mistune 0.8.4 msgpack 1.0.4 multidict 6.0.2 multipledispatch 0.6.0 mypy-extensions 0.4.3 nbclient 0.6.4 nbconvert 6.5.0 nbformat 5.4.0 nest-asyncio 1.5.5 networkx 2.8.4 notebook 6.4.12 numba 0.55.2 numpy 1.21.6 packaging 21.3 pandas 1.4.3 pandocfilters 1.5.0 panel 0.13.1 param 1.12.1 ParmEd 3.4.3 parso 0.8.3 partd 1.2.0 pathspec 0.10.1 pathtools 0.1.2 periodictable 1.6.1 pexpect 4.8.0 pickleshare 0.7.5 Pillow 9.1.1 pip 22.3 platformdirs 2.5.2 plotly 5.8.2 prometheus-client 0.14.1 promise 2.3 prompt-toolkit 3.0.29 protobuf 3.20.1 psutil 5.9.1 ptyprocess 0.7.0 pure-eval 0.2.2 pycparser 2.21 pyct 0.4.8 pyfaidx 0.7.1 Pygments 2.12.0 pynndescent 0.5.7 pyparsing 3.0.9 pyrsistent 0.18.1 python-dateutil 2.8.2 pytz 2022.1 pyviz-comms 2.2.0 PyWavelets 1.3.0 PyYAML 6.0 pyzmq 23.1.0 qtconsole 5.3.1 QtPy 2.1.0 requests 2.28.0 retrying 1.3.3 scikit-image 0.19.3 scikit-learn 1.1.1 scipy 1.8.1 seaborn 0.11.2 Send2Trash 1.8.0 sentry-sdk 1.6.0 setproctitle 1.2.3 setuptools 60.2.0 shortuuid 1.0.9 six 1.16.0 sklearn 0.0 smmap 5.0.0 sortedcontainers 2.4.0 soupsieve 2.3.2.post1 stack-data 0.3.0 tblib 1.7.0 tenacity 8.0.1 terminado 0.15.0 threadpoolctl 3.1.0 tifffile 2022.5.4 tinycss2 1.1.1 tomli 2.0.1 toolz 0.11.2 torch 1.11.0 torchsummary 1.5.1 tornado 6.1 tqdm 4.64.0 traitlets 5.3.0 typing_extensions 4.2.0 umap-learn 0.5.3 urllib3 1.26.9 wandb 0.12.20 wcwidth 0.2.5 webencodings 0.5.1 Werkzeug 2.2.2 wheel 0.37.1 widgetsnbextension 3.6.0 xarray 2022.3.0 yarl 1.8.1 zict 2.2.0

IvoLeist commented 1 year ago

Hi DashBio developers,

the one who did the NglMoleculeViewer PR a few years ago is speaking :v: During my PhD I unfortunately no longer work with Dash so I do not have the expertise (+ time to look into it)

But I guess "just" overwriting the stage.mouseControls of the core ngl viewer see below under Mouse: https://nglviewer.org/ngl/api/manual/interaction-controls.html with for example: stage.mouseControls.add("scroll-shift", NGL.MouseActions.zoom); should be sufficient.

For more context see the issue in my repo: https://github.com/IvoLeist/dash_ngl/issues/26