Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Change cursor when hovering over draggable artists#25412
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is nice to know that you can interact with the component 👍
Uh oh!
There was an error while loading.Please reload this page.
I was using the code from#25428 (comment) to test this. importmatplotlib.pyplotaspltplt.plot(range(5),label='bob')leg=plt.legend()leg.set_draggable(True,update='bbox')plt.show() |
Maybe this should get a |
@greglucas , I had a look at the macosx issue, and this is what's going on:
I think the solution might be for the macosx backend's On a related note,@QuLogic, should |
@daniilS lets keep the macosx issues discussed in the linked PR for that. I think this is a useful addition still and just needs a rebase at this point. |
I think you might need to rebase, as there seems to be some extra commits here. We have some instructions for that here:https://matplotlib.org/devdocs/devel/development_workflow.html#rewriting-commit-history |
80b0af1
to8ce6c89
CompareFixed the rebase. However, I found that this PR reveals a different issue with importmatplotlib.pyplotaspltline=plt.plot(range(3),label="line")[0]leg=plt.legend(draggable=True,loc="upper center",fontsize="xx-large",mode="expand")plt.show(block=False)plt.pause(1)plt.clf()plt.show()# cursor still changes when hovering over the top of the figure I think a hook should be added somewhere to call draggable_bug.webm |
Perhaps _Axes._remove_legend? (via _legend._remove_method) |
d76c7d9
to0bcfe16
Compare@anntzer thanks, that pointed me towards what I think is the right place! It looks to me like the best solution is to deparent the legend together with other artists in |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
if not ( | ||
self._check_still_parented() | ||
and self.canvas.widgetlock.available(self) | ||
and self.ref_artist.pickable() | ||
): | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is the logic correct? Ifself.ref_artist.pickable()
is False, we return. That means we never reach the originalif self.got_artist:
branch.
PR Summary
Currently, there's no visual indication that an artist is draggable. This sets the cursor to
Cursors.MOVE
when the mouse is hovering over aDraggableBase
instance which can be picked.A possible addition would be to set the widget lock in
on_pick()
untilon_release()
, which would prevent other draggables/widgets/toolbar modes from being active at the same time, but I wasn't sure if there is a reason thatwidgetlock
isn't already being used.draggable.legend.webm