存储当前鼠标位置(系统范围)然后(稍后)将鼠标放在该存储点的最佳方法是什么?
[NSEvent mouseLocation] http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/Reference/Reference.html#//apple_ref/occ/clm/NSEvent/mouseLocation获取位置,然后我可以用CGEventMouseMoved http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/doc/uid/TP40003550-CH202-BBCFCJGH,但它们各自使用不同的坐标系统(我相信 y=0 是 NSEvent 的顶部和 CGEvent 的底部)。
我担心捕获屏幕高度并使用它在两者之间进行转换的稳健性 - 或者这是最好的方法?
你可以使用CG事件点击 http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEventServicesRef/获取鼠标事件而不是 NSEvent。然后,您可以在活动到来时选择翻转或不翻转。
(我相信 y=0 是 NSEvent 的顶部和 CGEvent 的底部)。
你的做法是错误的。 Quartz采用翻转,即y=0=top。 AppKit使用unflipped,即y=0=bottom。 (编辑:对于事件,即 Quartz 2D,绘图 API,使用未翻转的坐标,与 AppKit 相同。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)