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

Commit

Permalink
Fix ProcessingView+Gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
natmark committed Oct 27, 2018
1 parent 54f3ee9 commit a2618f1
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions ProcessingKit/ProcessingView+Core/ProcessingView+Gesture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import UIKit
import Cocoa
#endif

extension ProcessingView: GestureModelContract {
extension ProcessingView {
#if os(iOS)
public var fingerPressed: Bool {
return self.gestureModel.fingerPressed
Expand Down Expand Up @@ -46,84 +46,60 @@ extension ProcessingView: GestureModelContract {
#endif

#if os(iOS)
public func touchesBegan(_ touches: Set<CGPoint>) {
self.gestureModel.touchesBegan(touches)
}

public func touchesMoved(_ touches: Set<CGPoint>) {
self.gestureModel.touchesMoved(touches)
}

public func touchesEnded(_ touches: Set<CGPoint>) {
self.gestureModel.touchesEnded(touches)
}

@objc public func didTap(recognizer: UITapGestureRecognizer) {
@objc func didTap(recognizer: UITapGestureRecognizer) {
self.gestureModel.didTap(recognizer: recognizer)

let dispatchTime = DispatchTime.now() + Double(1.0 / self.frameRate)
DispatchQueue.main.asyncAfter(deadline: dispatchTime) {
self.didTapExit(recognizer: recognizer)
}
}
public func didTapExit(recognizer: UITapGestureRecognizer) {
func didTapExit(recognizer: UITapGestureRecognizer) {
self.gestureModel.didTapExit(recognizer: recognizer)
}
@objc public func didSwipe(recognizer: UISwipeGestureRecognizer) {
@objc func didSwipe(recognizer: UISwipeGestureRecognizer) {
self.gestureModel.didSwipe(recognizer: recognizer)
}
@objc public func didPinch(recognizer: UIPinchGestureRecognizer) {
@objc func didPinch(recognizer: UIPinchGestureRecognizer) {
self.gestureModel.didPinch(recognizer: recognizer)
}
@objc public func didRotate(recognizer: UIRotationGestureRecognizer) {
@objc func didRotate(recognizer: UIRotationGestureRecognizer) {
self.gestureModel.didRotate(recognizer: recognizer)
}
@objc public func didPan(recognizer: UIPanGestureRecognizer) {
@objc func didPan(recognizer: UIPanGestureRecognizer) {
self.gestureModel.didPan(recognizer: recognizer)
}
@objc public func didLongPress(recognizer: UILongPressGestureRecognizer) {
@objc func didLongPress(recognizer: UILongPressGestureRecognizer) {
self.gestureModel.didLongPress(recognizer: recognizer)
}
#elseif os(OSX)
public func mouseDown(_ location: NSPoint) {
self.gestureModel.mouseDown(location)
}
public func mouseDragged(_ location: NSPoint) {
self.gestureModel.mouseDragged(location)
}
public func mouseUp(_ location: NSPoint) {
self.gestureModel.mouseUp(location)
}
public func mouseMoved(_ location: NSPoint) {
self.gestureModel.mouseMoved(location)
}
@objc public func didClick(recognizer: NSClickGestureRecognizer) {
@objc func didClick(recognizer: NSClickGestureRecognizer) {
self.gestureModel.didClick(recognizer: recognizer)

let dispatchTime = DispatchTime.now() + Double(1.0 / self.frameRate)
DispatchQueue.main.asyncAfter(deadline: dispatchTime) {
self.didClickExit(recognizer: recognizer)
}
}
@objc public func didClickExit(recognizer: NSClickGestureRecognizer) {
@objc func didClickExit(recognizer: NSClickGestureRecognizer) {
self.gestureModel.didClickExit(recognizer: recognizer)
}
@objc public func didMagnify(recognizer: NSMagnificationGestureRecognizer) {
@objc func didMagnify(recognizer: NSMagnificationGestureRecognizer) {
self.gestureModel.didMagnify(recognizer: recognizer)
}
@objc public func didPan(recognizer: NSPanGestureRecognizer) {
@objc func didPan(recognizer: NSPanGestureRecognizer) {
self.gestureModel.didPan(recognizer: recognizer)
}
@objc public func didPress(recognizer: NSPressGestureRecognizer) {
@objc func didPress(recognizer: NSPressGestureRecognizer) {
self.gestureModel.didPress(recognizer: recognizer)
}
@objc public func didRotate(recognizer: NSRotationGestureRecognizer) {
@objc func didRotate(recognizer: NSRotationGestureRecognizer) {
self.gestureModel.didRotate(recognizer: recognizer)
}
open override func scrollWheel(with event: NSEvent) {
open func scrollWheel(with event: NSEvent) {
self.gestureModel.scrollWheel(with: event)
}
open override func mouseMoved(with event: NSEvent) {
open func mouseMoved(with event: NSEvent) {
self.gestureModel.mouseMoved(with: event)
}
#endif
Expand Down

0 comments on commit a2618f1

Please sign in to comment.