苹果魔术鼠标 API
我刚刚买了一个Magic Mouse,我非常喜欢它。但作为一名 Mac 开发人员,这更酷。但有一个问题:是否已经有可用的 API?我想将它用于我的一个应用程序。例如,检测用户的手指位置、滑动或拉伸手势等...
有谁知道是否有一个 API(以及如何使用它)?
I just bought a Magic Mouse and I like it pretty much. But as a Mac Developer it's even cooler. But there's one problem: is there already an API available for it? I want to use it for one of my applications. For, example, detect the user's finger positions, swipe or stretch gestures etc...
Does anyone know if there's an API for it (and how to use it)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Magic Mouse不使用
NSTouch
API。我一直在尝试捕捉触摸信息。到目前为止我还没有运气。鼠标和触控板唯一通用的触摸方法是 swipeWithEvent: 方法。只需在设备上用两根手指滑动即可。看来来自鼠标的触摸输入正在其他地方被解释,然后转发到公共 API。我还没有找到真正完成这项工作的私有 API。
The Magic Mouse does not use the
NSTouch
API. I have been experimenting with it and attempting to capture touch information. I've had no luck so far. The only touch method that is common to both the mouse and the trackpad is theswipeWithEvent:
method. It is called for a two finger swipe on the device only.It seems the touch input from the mouse is being interpreted somewhere else, then forwarded on to the public API. I have yet to find the private API that is actually doing the work.
看看这里:http://www.iphonesmartapps.org/aladino/?a=multitouch
使用 CGEventPost 方法进行了完整的工作概念验证。
--
一切顺利!
get a look here: http://www.iphonesmartapps.org/aladino/?a=multitouch
there's a full working proof-of-concept using the CGEventPost method.
--
all the best!
我没有测试过,但如果它不使用 NSTouch。 NSTouch 是用于与当前 MacBook Pro(以及本周推出的新 MacBook)上的多点触控触控板进行交互的 API。您可以查看 LightTable 示例项目看看它是如何使用的。
它是 AppKit 的一部分,但它是仅限 Snow Leopard 的 API。
I have not tested, but I would be shocked if it didn't use NSTouch. NSTouch is the API you use to interact with the multi-touch trackpads on current MacBook Pros (and the new MacBooks that came out this week). You can check out the LightTable sample project to see how it is used.
It is part of AppKit, but it is a Snow Leopard only API.
在得到我的魔术鼠标之前,我搞乱了下面的应用程序。我惊讶地发现该应用程序还跟踪鼠标上的多点触摸。
评论中有一个指向某些来源的链接,可以类似地获取原始数据,但没有这个实际应用程序的来源。
http://lericson.blogg.se/code/ 2009/11月/multitouch-on-unibody-macbooks.html
I messed around with the below app before getting my magic mouse. I was surprised to find that the app also tracked the multi touch points on the mouse.
There is a link in the comments to some source that gets the raw data similarly, but there is no source to this actual app.
http://lericson.blogg.se/code/2009/november/multitouch-on-unibody-macbooks.html