I have a multitouch WPF application and I'd like to do a rotation of some stuff in it. The problem with ManipulationDelta
, that ManipulationOrigin
always is a center between 2 fingers, but I'd like to rotate with moving finger around fixed one.
Example: Finger1 fixed on screen and Finger2 goes around it, rotation with center in Finger1 point needed. Then Finger2 fixed and Finger1 goes around - now rotation with center in Finger2 point. All that stuff is done between one session of ManipulationStarted
and ManipulationCompleted
, because fingers is always on screen.
Now I'm trying to calculate vector between old position and new position, and rotate around finger, which position changed for minimum. It works, but not very well.
Any ideas how to get right rotation point at every moment in more nice way?
UPD: Problem of MSDN example (Clemens's code) - rectangle under Finger1 change it's position, while Finger1 was fixed.
Finger1 and Finger2 on fixed on screen.
Finger2 rotated around Finger1
UPD2:
If I do rotation around e.Menipulators.First().GetPosition(RotatingControl)
everything is OK. Problem, that finger can be changed and I need to know which finger is moving now. It's not a hard problem. But sometimes both fingers rotates - in such case rotation should occurs around ManipulationOrigin