如何从触控板单击来判断NSEvent,而不是单击以单击 [英] How to judge NSEvent from trackpad click, not tap to click
本文介绍了如何从触控板单击来判断NSEvent,而不是单击以单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
选中轻按以单击"时,如何从触控板单击(按下)或单击来判断NSEvent.
When "tap to click" checked, how judge NSEvent is from trackpad click(pressed down) or tap to click.
- (void)mouseEvent:(NSEvent*)theEvent {
if ((type == NSLeftMouseUp || type == NSLeftMouseDown) && [theEvent subtype] == NSEventSubtypeTouch) {
// How to detect touchpad is real pressed?? Not tap to cllick
}
}
推荐答案
要找出某人是否仅轻按一下",可以使用
To find out if someone only "tap to click" you could use
func pressureChange(with event: NSEvent)
在NSView上的NSViewController中.
in your NSViewController on NSView.
如果仅轻按"某人,则不会触发该功能.如果单击,您将获得压力变化的压力水平.
If someone only "tap" the function will not be triggered. In case of a click you will get the pressure level on pressure change.
override func pressureChange(with event: NSEvent) {
super.pressureChange(with: event)
print("pressure \(event.pressure)")
}
这篇关于如何从触控板单击来判断NSEvent,而不是单击以单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文