The first (starting) rotation angle sent to wxEVT_GESTURE_ROTATE event handler is too big on wxMSW:
Rotate gesture started
Rotate gesture performed with rotation center at (893, 742) and cumulative rotation angle = 42623.000000
Rotate gesture performed with rotation center at (894, 742) and cumulative rotation angle = 6.220387
Rotate gesture performed with rotation center at (895, 741) and cumulative rotation angle = 6.218470
Rotate gesture performed with rotation center at (896, 741) and cumulative rotation angle = 6.216552
Rotate gesture performed with rotation center at (819, 529) and cumulative rotation angle = 6.170915
It is missing the GID_ROTATE_ANGLE_FROM_ARGUMENT conversion here:
Everything works as expected with the following change (the first angle specifies the absolute angle relative to the rotation center):
diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 68d1ac3e10..dbfbd9157c 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -6231,30 +6231,25 @@ bool wxWindowMSW::HandleRotateGesture(const wxPoint& pt, // wxEVT_GESTURE_ROTATE wxRotateGestureEvent event(GetId()); - if ( InitGestureEvent(event, pt, flags) ) - { - event.SetRotationAngle(angleArgument); - } - else // Not the first event. - { - // Use angleArgument to obtain the cumulative angle since the gesture - // was first started. This angle is in radians and MSW returns negative - // angle for clockwise rotation and positive otherwise, so, multiply - // angle by -1 for positive angle for clockwise and negative in case of - // counterclockwise. - double angle = -GID_ROTATE_ANGLE_FROM_ARGUMENT(angleArgument); + InitGestureEvent(event, pt, flags); - // If the rotation is anti-clockwise convert the angle to its - // corresponding positive value in a clockwise sense. - if ( angle < 0 ) - { - angle += 2 * M_PI; - } + // Use angleArgument to obtain the cumulative angle since the gesture + // was first started. This angle is in radians and MSW returns negative + // angle for clockwise rotation and positive otherwise, so, multiply + // angle by -1 for positive angle for clockwise and negative in case of + // counterclockwise. + double angle = -GID_ROTATE_ANGLE_FROM_ARGUMENT(angleArgument); - // Set the angle - event.SetRotationAngle(angle); + // If the rotation is anti-clockwise convert the angle to its + // corresponding positive value in a clockwise sense. + if (angle < 0) + { + angle += 2 * M_PI; } + // Set the angle + event.SetRotationAngle(angle); + return HandleWindowEvent(event); }
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for reporting/debugging/fixing this! I don't have the hardware for gestures testing, so I'd be glad to just apply the PR with these changes.
Of course, if anybody else who can test this change could do it, it would be great, TIA!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()