How to judge NSEvent from trackpad click, not tap to click

Viewed 281

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
  }
}
1 Answers

To find out if someone only "tap to click" you could use

func pressureChange(with event: NSEvent) 

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)")
    }
Related