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

Refactor toolbar #396

Merged
merged 1 commit into from
Dec 15, 2021
Merged

Conversation

martinRenou
Copy link
Member

@martinRenou martinRenou commented Nov 12, 2021

Fix #299

toolbar.mp4

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch martinRenou/ipympl/refactor_toolbar

@martinRenou
Copy link
Member Author

There are some CSS issues still

@martinRenou martinRenou force-pushed the refactor_toolbar branch 6 times, most recently from d980aa9 to 4c7ec7b Compare November 18, 2021 14:50
@martinRenou
Copy link
Member Author

toolbar.mp4

@martinRenou
Copy link
Member Author

@tacaswell @SylvainCorlay @ianhi if you have any thoughts :) Feedback would be super welcome

@martinRenou
Copy link
Member Author

The plot is now centered in the cell output

@martinRenou martinRenou marked this pull request as ready for review November 18, 2021 14:54
@martinRenou martinRenou force-pushed the refactor_toolbar branch 2 times, most recently from 0d1dd88 to a86897c Compare November 18, 2021 15:26
@ianhi
Copy link
Collaborator

ianhi commented Nov 18, 2021

@tacaswell @SylvainCorlay @ianhi if you have any thoughts :) Feedback would be super welcome

Will look tonight or this weekend

Copy link
Collaborator

@ianhi ianhi left a comment

Choose a reason for hiding this comment

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

Sorry for the delay @martinRenou

general refactor
I am 👍 on the code simplification

fade in/out
👍
I think the fade in and out is nice and my one suggestion is that it should be toggleable by a user.

plot centering

Currently 👎 but open to being convinced or improving this.

Was this necessary to get the fading to work?

The two main issues that the centering brought for me are:

  1. Weird gap to the toolbar when the plot is small. This makes it inconvenient to use the toolbar because you have to move your mouse so far
    image

  2. The centering has a big impact on the dynamics of resizing the plot. It doubles the rate of resizing horizontally while leaving vertical resizing the same speed which feels very un-intuitive:
    toolbar-center-resize

I think what happened is that this breaks the assumption that when were resizing a window the opposite edges (top and left) will stay in their positions. Maybe this could be reconfigured so that those edges stay fixed while resizing? Otherwise I think this ends up being more detrimental than beneficial (users can already center the plot using ipywidgets although that isn't super smooth).

@martinRenou
Copy link
Member Author

Thanks for the review @ianhi :)

I can revert the centering of the plot. This was not the initial purpose of the PR anyway.

@martinRenou martinRenou force-pushed the refactor_toolbar branch 6 times, most recently from 0e8d54d to 376d61f Compare December 15, 2021 11:36
@lgtm-com
Copy link

lgtm-com bot commented Dec 15, 2021

This pull request introduces 1 alert when merging 376d61f into 480a236 - view on LGTM.com

new alerts:

  • 1 for First argument to super() is not enclosing class

@martinRenou martinRenou force-pushed the refactor_toolbar branch 2 times, most recently from 3b431cd to fa6cec5 Compare December 15, 2021 12:30
@martinRenou
Copy link
Member Author

@ianhi Thanks again for your review. I took your comments into account:

  • Reverted the centering of the plot
  • Made the fade-in fade-out effect optional (enabled by default)

@martinRenou martinRenou force-pushed the refactor_toolbar branch 2 times, most recently from f0d16f0 to 4629fe3 Compare December 15, 2021 13:17
@martinRenou martinRenou merged commit e91488d into matplotlib:master Dec 15, 2021
@martinRenou martinRenou deleted the refactor_toolbar branch December 15, 2021 14:26
height: auto;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@martinRenou i thought the centering was reverted?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was.. This looks like a leftover. But this does not seem to affect the plot? It is not centered when I try latest.

Copy link
Collaborator

Choose a reason for hiding this comment

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

huh i was just seeing this behavior. let me try in a fresh env

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see this on the binder link - maybe this is browser based. I'm on Firefox 93

Copy link
Collaborator

Choose a reason for hiding this comment

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

indeed on chrome it is not centered, but it is on firefox:

left = chrome
right = firefox
Peek 2022-01-19 18-15

Copy link
Member Author

Choose a reason for hiding this comment

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

I wish the visual regression tests caught that. We might be able to use playwright with Firefox as well. #422

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks a lot for catching this!

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.

Feature req: Show toolbar on mouse-over
2 participants