matplotlib / matplotlib/ipympl

Resizing extends outside the bounds of the notebook

Open
#242 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

## Describe the issue

If you drag the resize handle outside the limits of the notebook and release the mouse you lose the ability to resize as the handle will be hidden:
![wonky-resize](https://user-images.githubusercontent.com/10111092/87228336-8dbcc900-c36e-11ea-8ed8-bac8415939b9.gif)

This is a consequence of using a window mouse move listener: https://github.com/matplotlib/ipympl/blob/6b44a6f90cf74b12cfcf930b440010984d8a9b4d/js/src/mpl_widget.js#L272

Maybe there could be a check that it won't be resized to be larger the layout (`this.model.get('layout')`)?
## Versions

```
3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0]
ipympl version: 0.5.6
jupyter core : 4.6.1
jupyter-notebook : 6.0.3
qtconsole : 4.6.0
ipython : 7.12.0
ipykernel : 5.1.4
jupyter client : 5.3.4
jupyter lab : 2.1.5
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.4
traitlets : 4.3.3
Known nbextensions:
config dir: /home/ian/anaconda3/etc/jupyter/nbconfig
notebook section
jupyter-matplotlib/extension enabled
- Validating: OK
nbdime/index enabled
- Validating: OK
voila/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
JupyterLab v2.1.5
Known labextensions:
app dir: /home/ian/anaconda3/share/jupyter/lab
@axlair/jupyterlab_vim v0.12.2 enabled OK
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@jupyter-widgets/jupyterlab-sidecar v0.5.0 enabled OK
@jupyterlab/git v0.20.0-rc.0 enabled OK
jupyter-matplotlib v0.7.2 enabled OK
jupyterlab_vim-system-clipboard-support v0.1.0 enabled OK
nbdime-jupyterlab v2.0.0 enabled OK
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read js/src/mpl_widget.js around line 272 and reproduce the resize-handle behavior by dragging beyond the notebook bounds. Inspect how the window mousemove listener uses this.model.get('layout'); the issue is done when releasing outside the notebook does not leave the handle hidden or prevent further resizing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jupyter
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.