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

Add option to preventDefault on scroll event #235

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

ianhi
Copy link
Collaborator

@ianhi ianhi commented Jun 15, 2020

closes: #222

Following the way resizeable was added I added capture_scroll to the canvas object with a default of False. If set to true then the entire notebook will not scroll when a user scrolls the mouse over a canvas. This allows the enduser to implement things such as custom scroll to zoom methods.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

This seems sensible and correct to me

@martinRenou martinRenou merged commit 6b44a6f into matplotlib:master Jun 18, 2020
@dzanaga
Copy link

dzanaga commented Jun 24, 2020

@martinRenou regarding #240 I tried the new feature. After installing the latest from master, I tried to set fig.canvas.capture_scroll to either True or False but it doesn't work for me. Still getting the page scrolling when trying to scroll on the canvas.

Maybe I am not using it properly... I am using it like this:

self.fig, self.axs = plt.subplots(1, 2, **figure_options)
self.fig.canvas.capture_scroll = True

@ianhi ianhi deleted the capture-scroll branch June 24, 2020 14:07
@martinRenou
Copy link
Member

Could it be an installation issue? Are you using JupyterLab or Jupyter Notebook?

@dzanaga
Copy link

dzanaga commented Jul 1, 2020

I am using JupyterLab. If that's the way it should be used, could indeed be an installation issue...I am gonna try to do a fresh install of the miniconda environment when I have time and see if it's fixed there. Thanks

@martinRenou
Copy link
Member

Be sure to run jupyter labextension install js locally (from the ipympl root directory).

@dzanaga
Copy link

dzanaga commented Jul 2, 2020

That's it, it works now. Thanks for helping out and for the great work!

@martinRenou
Copy link
Member

Nice. We should make a release with this fix.

@ianhi
Copy link
Collaborator Author

ianhi commented Jul 2, 2020

Also the readme currently says jupyter labextension link ./js and this should probably instead say install see https://gitter.im/jupyterlab/jupyterlab?at=5ee6abf324a3382d5d68b2ae

@martinRenou
Copy link
Member

@ianhi If we do that, the cd js && npm run watch will not be relevant anymore so we might want to remove it.

@ianhi
Copy link
Collaborator Author

ianhi commented Jul 11, 2020

@martinRenou instructions updated in #243

Nice. We should make a release with this fix.

👍 yes please

@martinRenou
Copy link
Member

@ianhi Release done on PyPi. It should come soon on conda-forge as well.

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

Successfully merging this pull request may close these issues.

add option to preventDefault on scroll
4 participants