Skip to content

Commit

Permalink
Work around uxmstudio#76: Don't draw/annotate unless only one finger …
Browse files Browse the repository at this point in the history
…is used
  • Loading branch information
scottcc committed Nov 7, 2017
1 parent 9722770 commit 850332b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Pod/Classes/Annotations/PDFAnnotationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ open class PDFAnnotationController: UIViewController {

//MARK: - Touches methods to pass to annotation
open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else { return }
// We only allow one-finger touches to start annotations, as otherwise
// when you are pen-editing then try to zoom, one of your fingers will draw instead of zooming
// This is a HACK, as IDEALLY the two-finger pinch would zoom while still in
// annotation editing mode, but for the life of me I could not get that to go, forwarding
// events/touches to pretty much anything.
guard let touch = touches.first, event?.allTouches?.count == 1
else { return }

let page = annotationDelegate?.annotationWillStart(touch: touch)

Expand All @@ -252,14 +258,16 @@ open class PDFAnnotationController: UIViewController {


open override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else { return }
guard let touch = touches.first, event?.allTouches?.count == 1
else { return }
let point = touch.location(in: pageView)

currentAnnotation?.touchMoved(touch, point: point)
}

open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else { return }
guard let touch = touches.first, event?.allTouches?.count == 1
else { return }
let point = touch.location(in: pageView)

currentAnnotation?.touchEnded(touch, point: point)
Expand Down

0 comments on commit 850332b

Please sign in to comment.