我在 WinPhone 应用程序的 Canvas 上有图像。我可以使用以下代码缩放和翻译图像:
private void image_ManipulatioDelta(object sender, ManipulationDeltaEventArgs e)
{
//handle stretch and pinch gestures
if (e.DeltaManipulation.Scale.X != 0 && e.DeltaManipulation.Scale.Y != 0)
{
double scX = scaleImage.ScaleX * e.DeltaManipulation.Scale.X;
if (scX > 0)
{
scaleImage.ScaleX = scX;
}
double scY = scaleImage.ScaleY * e.DeltaManipulation.Scale.X;
if (scY > 0)
{
scaleImage.ScaleY = scY;
}
}
//handle pan gesture
translateImage.X += e.DeltaManipulation.Translation.X;
translateImage.Y += e.DeltaManipulation.Translation.Y;
}
但捏后图像移动速度增加。拉伸后图像移动速度降低。
如何使移动速度与图像大小无关?谢谢。