Skip to content

Add option to preventDefault on scroll event - #235

Merged
martinRenou merged 1 commit into
matplotlib:masterfrom
ianhi:capture-scroll
Jun 18, 2020
Merged

martinRenou merged 1 commit into
matplotlib:masterfrom
ianhi:capture-scroll

Conversation

@ianhi

@ianhi ianhi commented Jun 15, 2020

Copy link
Copy Markdown
Collaborator

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.

@tacaswell tacaswell left a comment

Copy link
Copy Markdown
Member

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

dzanaga commented Jun 24, 2020 •

Copy link
Copy Markdown

@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
Copy Markdown
Member

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

@dzanaga

dzanaga commented Jul 1, 2020 •

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@dzanaga

dzanaga commented Jul 2, 2020

Copy link
Copy Markdown

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

@martinRenou

Copy link
Copy Markdown
Member

Nice. We should make a release with this fix.

@ianhi

ianhi commented Jul 2, 2020

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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

ianhi commented Jul 11, 2020

Copy link
Copy Markdown
Collaborator Author

@martinRenou instructions updated in #243

Nice. We should make a release with this fix.

👍 yes please

@martinRenou

Copy link
Copy Markdown
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