objective-c - 如何从触控板点击判断NSEvent,而不是点击点击
问题描述
当勾选“点击点击”时,如何判断 NSEvent 是来自触控板点击(按下)还是点击点击。
- (void)mouseEvent:(NSEvent*)theEvent {
if ((type == NSLeftMouseUp || type == NSLeftMouseDown) && [theEvent subtype] == NSEventSubtypeTouch) {
// How to detect touchpad is real pressed?? Not tap to cllick
}
}
解决方案
要了解是否有人只能“点击以单击”,您可以使用
func pressureChange(with event: NSEvent)
在 NSView 上的 NSViewController 中。
如果有人只是“点击”该功能将不会被触发。如果单击,您将获得压力变化的压力水平。
override func pressureChange(with event: NSEvent) {
super.pressureChange(with: event)
print("pressure \(event.pressure)")
}
推荐阅读
- python - 使用Opencv c ++在图像中查找小圆圈
- php - WordPress - 按最后日期更新获取帖子
- cv2 - 系统错误:
返回带有错误集的结果 - quarkus - Quarkus:在执行新的 YML 之前是否需要删除部署 kubernetes 组件
- node.js - 如何通过推送数组在 Mongoose 中建立一对多关系?
- numpy - 在 numpy 中为 2D 数组查找 2 个掩码之间的剩余掩码
- python - 安装构建依赖项...使用 pip 安装 pyInstaller 时出错
- java - 找不到符号:方法 findViewByID(int)
- flutter - 如何在 Flutter 中配置自定义 Listview 以及自定义可编辑子 ListView?
- angular - TS2611:“foo”被定义为“A”类中的属性,但在“B”中作为访问器被覆盖