fix displace of the selectioon area and mouse position in "Rect Mode".#2017
fix displace of the selectioon area and mouse position in "Rect Mode".#2017leo603222 wants to merge 3 commits intopyqtgraph:masterfrom
Conversation
|
Dear @leo603222 , welcome! I am sorry, I haven't had time to look at this in detail yet. But your proposed changes look very reasonable, and seem to give a good explanation of what has been going wrong in the first place! What I am wondering right now is how does the presence of the grid make this work/fail? I guess you might have a better understanding of this after your experimentation... Would you mind sharing that with us? |
|
@NilsNemitz , there's a big difference between grid on and off. |
|
Hi @leo603222 Thanks for the PR! Around these parts we get nervous when it comes to changes to That said, as @NilsNemitz said, the changes look very reasonable, I'll try and test it out against the test code in the issue you referenced in the next day or so, since the test suite passes, and if I can verify the PR fixes the issue as described I'll merge right away. Also FYI, when you make a PR, it's easier for us if you don't name your branch the name of a branch in this repository. The reasoning being that I can't just Your first PR modifying ViewBox.py is an impressive feat 😆 |
| GraphicsWidget.__init__(self) | ||
| GraphicsWidgetAnchor.__init__(self) | ||
| self.setFlag(self.GraphicsItemFlag.ItemIgnoresTransformations) | ||
| # self.setFlag(self.GraphicsItemFlag.ItemIgnoresTransformations) |
There was a problem hiding this comment.
Hi @leo603222
Can you either delete this line, or undo the comment and make the removal of this line part of a separate PR?
Thanks!
There was a problem hiding this comment.
Sorry, I'm not familiar with git.
I have undo the change of LegendItem, and rename my branch name too.
There was a problem hiding this comment.
ahh, didn't mean for you to close the PR, I'd be happy to provide some guidance. In the future, if you want to drop the most recent commit in a branch, you can run
git reset --hard HEAD^
git push --force-with-lease
I'm happy to provide that kind of assistance; while I'm no git expert, I know it can be confusing with how to make these kinds of changes 👍🏻
|
I've verified the PR works as intended; I'm good to merge. I would prefer to leave the change to |
|
Hi @leo603222 I wrote this late last night, didn't mean to imply you should close out this PR; I was able to clone into your branch; I did have to run a more complex command due to the branch naming, but it wasn't some insurmountable task :) In case you're curious, if someone has a branch name something like In the case where there is branch naming conflicts, as this PR had, for the last command instead of the but I have to stack overflow it each time because I always forget 😆 Anyway Hope you submit the changes to |
For a plot with x- and y-grid lines as well as the right axis enabled, the selection area's bottom right corner (created for mouse interaction mode set to RectMode) is (stronlgy) displaced from the mouse cursor position.
Detail information see #1937.
I track into the source code,and found some problems in
ViewBox.mouseDragEvent()andViewBox.updateScaleBox().ev.buttonDownPos()inmouseDragEvent()return a pos in the coordinate of an AxisItem.r = self.childGroup.mapRectFromParent(r)inupdateScaleBox()needs to use a pos in ViewBox's coordinate.These two coordinate is not consistent, and this problem cause the displace of the selectioon area and mouse position.
I fix this problem by using scene coordinate in these two places, And everything works fine to me.