Skip to content

Commit a224668

Browse files
committed
Merge pull request #640 from C4Framework/PinchLocation
Adds locations and center to pinch gesture
2 parents dff1ef3 + a602818 commit a224668

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: C4/UI/UIGestureRecognizer+Closure.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ extension UIPanGestureRecognizer {
176176
}
177177

178178

179-
public typealias PinchAction = (scale: Double, velocity: Double, state: UIGestureRecognizerState) -> ()
179+
public typealias PinchAction = (locations: [Point], center: Point, scale: Double, velocity: Double, state: UIGestureRecognizerState) -> ()
180180

181181
extension UIPinchGestureRecognizer {
182182
/// The closure to call when there is a gesture event.
@@ -208,7 +208,11 @@ extension UIPinchGestureRecognizer {
208208
self.action = action
209209
}
210210
func handleGesture(gestureRecognizer: UIPinchGestureRecognizer) {
211-
action(scale: Double(gestureRecognizer.scale), velocity: Double(gestureRecognizer.velocity), state: gestureRecognizer.state)
211+
var locations = [Point]()
212+
for i in 0..<gestureRecognizer.numberOfTouches() {
213+
locations.append(Point(gestureRecognizer.locationOfTouch(i, inView: gestureRecognizer.referenceView)))
214+
}
215+
action(locations: locations, center: gestureRecognizer.location, scale: Double(gestureRecognizer.scale), velocity: Double(gestureRecognizer.velocity), state: gestureRecognizer.state)
212216
}
213217
}
214218
}

0 commit comments

Comments
 (0)