【发布时间】:2014-07-24 23:53:03
【问题描述】:
我可以使用捏放大和缩小我在画布中拍摄的图像。但我也希望在单指触摸上移动图像以实现捏缩放功能,我必须用两根手指触摸。我使用操作增量进行缩放。任何人都可以建议
private void OnManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
{
if (e.DeltaManipulation.Scale.X > 0.0 && e.DeltaManipulation.Scale.Y > 0.0)
{
// Scale in the X direction
double tmp = PenguinTransform.ScaleX * e.DeltaManipulation.Scale.X;
if (tmp < 1.0)
tmp = 1.0;
else if (tmp > 4.0)
tmp = 4.0;
PenguinTransform.ScaleX = tmp;
// Scale in the Y direction
tmp = PenguinTransform.ScaleY * e.DeltaManipulation.Scale.Y;
if (tmp < 1.0)
tmp = 1.0;
else if (tmp > 4.0)
tmp = 4.0;
PenguinTransform.ScaleY = tmp;
}
}
【问题讨论】:
标签: c# xaml windows-phone-8