Skip to content
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

zoom_factory does not prevent scroll events in WebAgg backend #8

Open
antoniovazquezblanco opened this issue Jun 1, 2023 · 1 comment

Comments

@antoniovazquezblanco
Copy link

Bug report

I am using zoom_factory with the WebAgg backend. Using the scroll wheel on the canvas does not prevent my browser from scrolling...

zoom_factory

Code for reproduction

#!/usr/bin/env python

import matplotlib
from matplotlib import pyplot
from mpl_interactions import zoom_factory
import numpy as np

matplotlib.use("WebAgg")

fig = pyplot.gcf()
zoom_factory(fig.gca())

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig.gca().plot(t, s)

pyplot.show()

Actual outcome

Scroll affects both my figure and the browser window...

Expected outcome

Scroll only affects my figure...

Version Info

  • Operating system: Affects both Windows and Archlinux
  • Matplotlib version: 3.7.1
  • Matplotlib backend: WebAgg
  • Python version: 3.11.2 & 3.11.3
@ianhi
Copy link
Collaborator

ianhi commented Jun 1, 2023

This is unfortunately a bug (or rather missing feature) in the webagg backend. I fixed this in ipympl (based on webagg) like this:

https://github.com/matplotlib/ipympl/blob/9b85cab605c960365e4f217589f8aa7ac6c31274/src/mpl_widget.ts#L547-L551

so I suspect that something similar could be implemented added to webagg here: https://github.com/matplotlib/matplotlib/blob/515cce40f14a4fe4eed15ddaa569052badb71229/lib/matplotlib/backends/web_backend/js/mpl.js#L301-L308

I suggest you open a feature request on the matplotlib repo for this. (feel free to tag me as well) (edit see matplotlib/matplotlib#26032)

@ianhi ianhi transferred this issue from mpl-extensions/mpl-interactions Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants