Created
July 25, 2017 16:03
-
-
Save eonist/71c68d69d879c05074d638b106eb4245 to your computer and use it in GitHub Desktop.
ForceTouch in macOS teating pressureChange
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func pressureChange(with event: NSEvent) { | |
| /*A value from 0.0 through 1.0 indicating the degree of pressure applied to an appropriate input device.*/ | |
| Swift.print("event.pressure: " + "\(event.pressure)") | |
| /*The pressure behavior and progression for an event of type pressure.*/ | |
| switch event.pressureBehavior {//<-NSPressureBehavior | |
| case .primaryAccelerator: | |
| Swift.print("primaryAccelerator") | |
| case .primaryDeepClick: | |
| Swift.print("primaryDeepClick") | |
| case .primaryDeepDrag: | |
| Swift.print("primaryDeepDrag") | |
| case .primaryDefault: | |
| Swift.print("primaryDefault") | |
| case .primaryGeneric: | |
| Swift.print("primaryGeneric") | |
| case .unknown: | |
| Swift.print("unknown") | |
| case .primaryClick: | |
| Swift.print("primaryClick") | |
| } | |
| /*A value of 0, 1, or 2, indicating the stage of a gesture event of type pressure.*/ | |
| Swift.print("event.stage: " + "\(event.stage)") | |
| /*The transition value for the stage of a pressure gesture event of type pressure.*/ | |
| Swift.print("event.stageTransition: " + "\(event.stageTransition)") | |
| super.pressureChange(with: event)//forward the event | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment