Repository navigation
Assign event to later Axes if zorders are tied. - #9389
Merged
Merged
Conversation
tacaswell
reviewed
Oct 13, 2017
| axes_list = [self.canvas.mouse_grabber] | ||
|
|
||
| if axes_list: # Use highest zorder. | ||
| self.inaxes = max(axes_list, key=lambda x: x.zorder) |
Member
There was a problem hiding this comment.
Can we do max(reversed(axes_list), key=lambda x: x.zorder) instead?
Contributor
Author
There was a problem hiding this comment.
I'd rather be explicit about the fact that order in axes_list does matter (at least I wouldn't have thought that the way max breaks ties is so important by skimming through the code).
QuLogic
reviewed
Oct 13, 2017
|
|
||
| if axes_list: # Use highest zorder. | ||
| self.inaxes = max(axes_list, key=lambda x: x.zorder) | ||
| # Use highest zorder; use later axis in case of a tie as they are |
anntzer
force-pushed
the
overlayed-axes-events
branch
from
October 13, 2017 19:57
ee857f5 to
1b675af
Compare
tacaswell
approved these changes
Oct 15, 2017
Member
|
@anntzer This is on a hot-path (created on every mouse move), it may be worth doing a micro-optimization here. |
Contributor
Author
|
Apparently I'm not the only one who missed that subtlety (https://github.com/matplotlib/matplotlib/pull/7102/files). Fixing that... |
Contributor
Author
|
fixed in a bunch of places and used a slightly overoptimized version :-) |
anntzer
force-pushed
the
overlayed-axes-events
branch
from
October 15, 2017 04:06
1b675af to
0859fd5
Compare
tacaswell
approved these changes
Oct 15, 2017
If axes zorders are tied, axes appearing later in figure.axes get drawn above those appearing earlier, so events should be preferably assigned to them. By default, max() returns the *first* maximum in case of ties, so the previous implementation was not satisfactory.
anntzer
force-pushed
the
overlayed-axes-events
branch
from
October 21, 2017 19:09
0859fd5 to
7a8a8e7
Compare
dstansby
approved these changes
Oct 30, 2017
QuLogic
added a commit
that referenced
this pull request
Oct 31, 2017
Backport PR #9389 on branch v2.1.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If axes zorders are tied, axes appearing later in figure.axes get
drawn above those appearing earlier, so events should be preferably
assigned to them. By default, max() returns the first maximum in case
of ties, so the previous implementation was not satisfactory.
Closes #9388.
PR Summary
PR Checklist