-
Notifications
You must be signed in to change notification settings - Fork 635
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
DYN-4305: After panning, sometimes zooming doesn't zoom into the mouse position #13095
Conversation
tt.X = p.X; | ||
tt.Y = p.Y; | ||
var tt = GetChildTranslateTransform(); | ||
if (tt.X != p.X || tt.Y != p.Y) |
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.
Keeping code that stops propagation if nothing has changed.
} | ||
|
||
#region Child Events | ||
|
||
private void child_MouseWheel(object sender, MouseWheelEventArgs e) | ||
{ | ||
if (child != null) | ||
if (child != null && !child.IsMouseCaptured) |
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.
Do not allow zoom if middle button is down. This caused zoom to jump.
@@ -1310,7 +1310,7 @@ private void SetCurrentOffset(object parameter) | |||
|
|||
//set the current offset without triggering | |||
//any property change notices. | |||
if (Model.X != p.X && Model.Y != p.Y) | |||
if (Model.X != p.X || Model.Y != p.Y) |
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 was the second bug. Zoom jumped if only X or Y changed during pan.
@@ -173,6 +178,12 @@ private void child_MouseMove(object sender, MouseEventArgs e) | |||
|
|||
// Change ZoomBorder's child translation | |||
Vector v = start - e.GetPosition(this); | |||
|
|||
if (v.Length == 0.0) |
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.
maybe use a tolerance ? I guess it does not matter that much...
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.
I was thinking of it but the values I have seen here have been 0,1,2 etc and 0 has been 0 in those cases. So I think this is good enough.
{ | ||
st.ScaleX = zoom; | ||
st.ScaleY = zoom; | ||
var tt = GetTranslateTransform(child); |
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.
GetChildTranslateTransform() ?
I saw you used this method at line 103
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.
Yes, could be used here. I may do a pass and use the child version of these methods.
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.
A couple of minor comments
Purpose
This pull request does:
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
Initiating a zoom right after a pan no longer sporadically zooms around the wrong position.
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of