Skip to content

Instantly share code, notes, and snippets.

@ryanmcgrath
Created December 3, 2018 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanmcgrath/8031bde4b779dabbfb1aefe30ee5c572 to your computer and use it in GitHub Desktop.
Save ryanmcgrath/8031bde4b779dabbfb1aefe30ee5c572 to your computer and use it in GitHub Desktop.
override func touchesBegan(with event: NSEvent) {
if(isTracking) { return }
let initialTouches = event.touches(matching: .touching, in: view)
if(initialTouches.count != 2) { return }
isTracking = true
initialPoint = view.convert(event.locationInWindow, from: nil)
let touches = Array(initialTouches)
initialTouchOne = touches[0]
initialTouchTwo = touches[1]
currentTouchOne = touches[0]
currentTouchTwo = touches[1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment