Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #103 from natmark/natmark/gestures
Browse files Browse the repository at this point in the history
Support gesture events
  • Loading branch information
natmark authored Oct 27, 2018
2 parents 8ebe20c + e37f00d commit 2a86a7f
Show file tree
Hide file tree
Showing 14 changed files with 877 additions and 519 deletions.
56 changes: 36 additions & 20 deletions ProcessingKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ProcessingKit/Core/Context/Context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public typealias UIFont = NSFont
public typealias UIEvent = NSEvent
public typealias UIView = NSView
public typealias UIResponder = NSResponder
public typealias CGRect = NSRect
public typealias CGPoint = NSPoint
#endif

public protocol ContextComponenetsContract {
Expand Down
16 changes: 15 additions & 1 deletion ProcessingKit/Core/Extensions/CGPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@
import UIKit
#elseif os(OSX)
import Cocoa
public typealias CGPoint = NSPoint
#endif

extension CGPoint: Hashable {
func distance(point: CGPoint) -> Float {
let dx = Float(x - point.x)
let dy = Float(y - point.y)
return sqrt((dx * dx) + (dy * dy))
}
public var hashValue: Int {
return x.hashValue << 32 ^ y.hashValue
}
}

func == (lhs: CGPoint, rhs: CGPoint) -> Bool {
return lhs.distance(point: rhs) < 0.000001
}

extension CGPoint {
func addTo(_ a: CGPoint) -> CGPoint {
return CGPoint(x: self.x + a.x, y: self.y + a.y)
Expand Down
216 changes: 0 additions & 216 deletions ProcessingKit/Core/Input/Event.swift

This file was deleted.

Loading

0 comments on commit 2a86a7f

Please sign in to comment.