1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-11 13:15:35 +03:00

Universal input events

This commit is contained in:
Viktor Sukochev 2017-08-31 18:23:48 +07:00
parent 3f21d37a8c
commit ed9eeb05e7

View File

@ -172,20 +172,6 @@ import Foundation
}
private func handleInput(event: NSEvent, handler: (_ touches: [MTouchEvent]) -> Void ) {
// Touch pad
if event.subtype == .touch {
let touchPoints = event.touches(matching: .any, in: self).map { touch -> MTouchEvent in
let location = touch.location(in: self)
let id = Int(bitPattern: Unmanaged.passUnretained(touch).toOpaque())
return MTouchEvent(x: Double(location.x), y: Double(location.y), id: id)
}
handler(touchPoints)
return
}
// Mouse
let location = self.convert(event.locationInWindow, to: .none)
let touchPoint = MTouchEvent(x: Double(location.x), y: Double(location.y), id: 0)