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:
parent
3f21d37a8c
commit
ed9eeb05e7
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user