将两个 safari 都“接触”到来自手势事件?

发布于 2024-09-25 07:31:31 字数 411 浏览 0 评论 0原文

我想获取 手势事件gesturestartgesturechangegestureend)在移动 Safari(iOS:iPad)上/iPhone)。我知道手势*事件实际上并没有在事件参数中提供此信息,但我认为可能有一个“技巧”来获取此信息。在跟踪手势的同时获取手指的坐标(例如,以同一手势缩放和移动对象)会很棒。

这可以做到吗?

I want to get the position (relative or otherwise) of the two fingers/touches inside a gesture event (gesturestart, gesturechange, gestureend) on mobile Safari (iOS: iPad/iPhone). I know that the gesture* events don't actually provide this in the event args but i thought there might be a 'trick' to getting this info. It would be great to get the coords of the fingers while tracking a gesture (eg. scaling and moving an object in the same gesture).

Can this be done?

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

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

发布评论

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

评论(2

零時差 2024-10-02 07:31:31

事实证明,这些信息不能通过“手势”事件直接获得。 touch 事件是关键,我能够获取触摸集合并使用前两次触摸来导出两组坐标的增量/中点。这似乎有效。

It turns out that this information is not directly available via the 'gesture' events. The touch events are the key and i was able to get the touches collection and use the first two touches to derive a delta/midpoint of the two sets of coords. This seems to work.

把时间冻结 2024-10-02 07:31:31

触摸事件的返回事件对象中有三个数组:

  1. Touches
  2. targetTouches
  3. ChangeTouches

我不记得最初在哪里找到此信息,但快速 Google 搜索会显示 http://www.sitepen.com/blog/2008/07/10/touching-and-在 iPhone 上做手势/

明白了! https://developer.apple.com/ Library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html 位于“处理多点触控事件”

There are three arrays in the returned event object for touch event:

  1. touches
  2. targetTouches
  3. changedTouches

I can't remember where I originally found this info, but a quick Google search brings up http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/

Got it! https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html Down at "Handling Multi-Touch Events"

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