Windows Phone 7:使用捏合手势进行捏合并作为辅助拖动手势

发布于 2024-10-10 03:34:19 字数 241 浏览 0 评论 0原文

我正在使用拖动手势来移动画布上的元素。我正在使用捏合手势来缩放/平移画布的大小。我现在想做的是根据两根手指捏紧时的移动来移动整个画布。我知道我可以通过移动来做到这一点,但我需要画布本身上的项目,有时整个画布都被项目覆盖,这样您就无法选择画布来移动它。

alt text

这可以通过 PinchGestureEventArgs 实现吗?

I am using the drag gesture to move elements on a canvas. I am using the pinch gesture to zoom/tranlate the size of the canvas. What I want to do now is move the entire canvas based on the movement of both fingers in a pinch. I know I can do this with the move, but I need that for items on the canvas itself, and sometimes the entire canvas is covered with items that would make it so you could not select the canvas to move it.

alt text

Is this possible with the PinchGestureEventArgs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

禾厶谷欠 2024-10-17 03:34:19

我确信您很久以前就已经解决了这个问题,但我最近也在做类似的事情:

在 PinchDelta 事件中,您收到一个 PinchGestureEventArgs。

您可以使用事件上的 GetPosition 方法来发现两个手指的位置(传递索引第二个参数),尽管在这种情况下您只需要第一根手指。

通过检查 DistanceRatio 是否表明自捏合开始以来手指之间的距离没有发生太大变化,您可以检查这是拖动还是捏合,并根据 GetPosition() 报告的位置移动画布。

您需要保持某种状态,以记住您处理的最后一个位置,以便您可以计算增量。

I am sure you have solved this a long time ago, but I was recently doing something similar myself:

In the PinchDelta event you receive a PinchGestureEventArgs.

You can use the GetPosition method on the event to discover the positions of both fingers (passing the index second parameter), although in this case you only need the first finger.

By checking that the DistanceRatio indicates the distance between the fingers has not changed much since the pinch started, you can check whether this is a drag or a pinch, and move the canvas based on the position reported by GetPosition().

You'll need to maintain some state, to remember the last position you handled, so that you can calculate the delta.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文