summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLPinchGesture.m
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2016-06-15 16:17:33 -0700
committerMuller, Alexander (A.) <amulle19@ford.com>2016-06-15 16:17:33 -0700
commit3ca1d55563b855e5b6a84ce0e75e85d02b551b6d (patch)
tree535b5e406c4f3d9ca42a5e2d1a69b7a61f9cd00c /SmartDeviceLink/SDLPinchGesture.m
parent17337c423d1b768f02203345352b661d87bf92f0 (diff)
downloadsdl_ios-3ca1d55563b855e5b6a84ce0e75e85d02b551b6d.tar.gz
Fixed issue relating to using C files in cocoapods.
Diffstat (limited to 'SmartDeviceLink/SDLPinchGesture.m')
-rw-r--r--SmartDeviceLink/SDLPinchGesture.m38
1 files changed, 38 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLPinchGesture.m b/SmartDeviceLink/SDLPinchGesture.m
new file mode 100644
index 000000000..d1bcb4b8c
--- /dev/null
+++ b/SmartDeviceLink/SDLPinchGesture.m
@@ -0,0 +1,38 @@
+//
+// SDLPinchGesture.c
+// SmartDeviceLink-iOS
+//
+// Created by Muller, Alexander (A.) on 6/14/16.
+// Copyright © 2016 smartdevicelink. All rights reserved.
+//
+
+#include "SDLPinchGesture.h"
+
+SDLPinchGesture SDLPinchGestureMake(SDLTouch firstTouch, SDLTouch secondTouch) {
+ SDLPinchGesture pinchGesture;
+ pinchGesture.firstTouch = firstTouch;
+ pinchGesture.secondTouch = secondTouch;
+ pinchGesture.center = CGPointCenterOfPoints(firstTouch.location, secondTouch.location);
+ pinchGesture.distance = CGPointDistanceBetweenPoints(firstTouch.location, secondTouch.location);
+ return pinchGesture;
+}
+
+const SDLPinchGesture SDLPinchGestureZero = {SDLTouchZero, SDLTouchZero, -0, {0, 0}};
+
+SDLPinchGesture SDLPinchGestureUpdateFromTouch(SDLPinchGesture pinch, SDLTouch touch) {
+ switch (touch.identifier) {
+ case SDLTouchIdentifierFirstFinger:
+ return SDLPinchGestureMake(touch, pinch.secondTouch);
+ break;
+ case SDLTouchIdentifierSecondFinger:
+ return SDLPinchGestureMake(pinch.firstTouch, touch);
+ break;
+ default:
+ return SDLPinchGestureZero;
+ break;
+ }
+}
+
+bool SDLPinchGestureIsValid(SDLPinchGesture pinch) {
+ return SDLTouchIsValid(pinch.firstTouch) && SDLTouchIsValid(pinch.secondTouch);
+} \ No newline at end of file