Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Allow Artists to show pixel data in cursor display#3989
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Changes fromall commits
34854db7e0d1ca97640da139d82017e4211fcda62b8ea950402456b8641304c3f20d3a585015088b56beaece69507745c876263947b0b6b1f5ff73fea565c61429206e62b0e334b4df48f266a170983ffcd0e52b8ce3a6fbac8dffFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Allow Artists to Display Pixel Data in Cursor | ||
| --------------------------------------------- | ||
| Adds `get_pixel_data` and `format_pixel_data` methods to artists | ||
| which can be used to add zdata to the cursor display | ||
| in the status bar. Also adds an implementation for Images. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1694,15 +1694,9 @@ def onRemove(self, ev): | ||
| canvas.mpl_connect('mouse_press_event',canvas.onRemove) | ||
| """ | ||
| # Find the top artist under the cursor | ||
| under = self.figure.hitlist(ev) | ||
| under.sort(key=lambda x: x.zorder) | ||
| h = None | ||
| if under: | ||
| h = under[-1] | ||
| @@ -2800,6 +2794,16 @@ def mouse_move(self, event): | ||
| except (ValueError, OverflowError): | ||
| pass | ||
| else: | ||
| artists = event.inaxes.hitlist(event) | ||
| if event.inaxes.patch in artists: | ||
| artists.remove(event.inaxes.patch) | ||
| if artists: | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Something seems odd about checking if Also, +1 for removing ye olden style DSU in favor of MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Good call, done. | ||
| artists.sort(key=lambda x: x.zorder) | ||
| a = artists[-1] | ||
| data = a.get_cursor_data(event) | ||
| if data is not None: | ||
| s += ' [%s]' % a.format_cursor_data(data) | ||
| if len(self.mode): | ||
| self.set_message('%s, %s' % (self.mode, s)) | ||
| else: | ||