将两个 safari 都“接触”到来自手势事件?
我想获取 手势事件(gesturestart
、gesturechange
、gestureend
)在移动 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,这些信息不能通过“手势”事件直接获得。
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.触摸事件的返回事件对象中有三个数组:
我不记得最初在哪里找到此信息,但快速 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:
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"