motion-wiretap 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d28f1e832294f594579798c62718339c9822a31
4
- data.tar.gz: aeeec36e2613e003f5d90788ffad2b9a06c4e56c
3
+ metadata.gz: 89990796420716d29cbbeaa225d9395e41087549
4
+ data.tar.gz: 834a690549b69160c7f694a674635a807fbe518b
5
5
  SHA512:
6
- metadata.gz: 19c5b44d1a0b39827bf145baa0664f099ea239e487936a24246609aac88422a56cd2f8809c31043281618153c3fdf78748044a4a6808dc6e22721c004e534ee2
7
- data.tar.gz: 6043ff1c69787e815f115d616399d19ad1296dc9fc9b08b3b2a67ce50f0febf8d9fc9795bbb566a577c51a20f4cf8a68cb55a6c6d7fdd67f0829c8aecc4944c2
6
+ metadata.gz: 90d3189dec24db8443afcefdb62d64e0276f3c51a44961d310f76ea8a0f418810219b70ae6bffe88bff42c5d6b749252bea96ddb5b69d3d0720c69d7ff5ac050
7
+ data.tar.gz: a44b1ffa4741e95a59cae83d4300572e4c008c292ec7516f4561e700bc01d2a89e2cb96c7b81e170099f1d0e75cef3ecf857b92583d8d54f5b5d925dc8ac7f4b
@@ -13,11 +13,13 @@ module MotionWiretap
13
13
  def tap(target, taps_or_options=nil)
14
14
  taps = nil
15
15
  fingers = nil
16
+ delegate = nil
16
17
 
17
18
  if taps_or_options
18
19
  if taps_or_options.is_a? Hash
19
- taps = taps_or_options[:taps] || taps
20
- fingers = taps_or_options[:fingers] || fingers
20
+ taps = taps_or_options[:taps]
21
+ fingers = taps_or_options[:fingers]
22
+ delegate = taps_or_options[:delegate]
21
23
  else
22
24
  taps = taps_or_options
23
25
  end
@@ -26,18 +28,47 @@ module MotionWiretap
26
28
  recognizer = UITapGestureRecognizer.alloc.initWithTarget(target, action: 'handle_gesture:')
27
29
  recognizer.numberOfTapsRequired = taps if taps
28
30
  recognizer.numberOfTouchesRequired = fingers if fingers
31
+ recognizer.delegate = delegate if delegate
29
32
  return recognizer
30
33
  end
31
34
 
32
35
  # @yield [recognizer] Handles the gesture event, and passes the recognizer instance to the block.
33
- def pinch(target)
36
+ def pinch(target, scale_or_options=nil)
37
+ scale = nil
38
+ delegate = nil
39
+
40
+ if scale_or_options
41
+ if scale_or_options.is_a? Hash
42
+ scale = scale_or_options[:scale]
43
+ delegate = scale_or_options[:delegate]
44
+ else
45
+ scale = scale_or_options
46
+ end
47
+ end
48
+
34
49
  recognizer = UIPinchGestureRecognizer.alloc.initWithTarget(target, action: 'handle_gesture:')
50
+ recognizer.scale = scale if scale
51
+ recognizer.delegate = delegate if delegate
35
52
  return recognizer
36
53
  end
37
54
 
38
55
  # @yield [recognizer] Handles the gesture event, and passes the recognizer instance to the block.
39
- def rotate(target)
56
+ def rotate(target, rotation_or_options=nil)
57
+ rotation = nil
58
+ delegate = nil
59
+
60
+ if rotation_or_options
61
+ if rotation_or_options.is_a? Hash
62
+ rotation = rotation_or_options[:rotation]
63
+ delegate = rotation_or_options[:delegate]
64
+ else
65
+ rotation = rotation_or_options
66
+ end
67
+ end
68
+
40
69
  recognizer = UIRotationGestureRecognizer.alloc.initWithTarget(target, action: 'handle_gesture:')
70
+ recognizer.rotation = rotation if rotation
71
+ recognizer.delegate = delegate if delegate
41
72
  return recognizer
42
73
  end
43
74
 
@@ -50,11 +81,13 @@ module MotionWiretap
50
81
  def swipe(target, direction_or_options)
51
82
  direction = nil
52
83
  fingers = nil
84
+ delegate = nil
53
85
 
54
86
  if direction_or_options
55
87
  if direction_or_options.is_a? Hash
56
- direction = direction_or_options[:direction] || direction
57
- fingers = direction_or_options[:fingers] || fingers
88
+ direction = direction_or_options[:direction]
89
+ fingers = direction_or_options[:fingers]
90
+ delegate = direction_or_options[:delegate]
58
91
  else
59
92
  direction = direction_or_options
60
93
  end
@@ -74,6 +107,7 @@ module MotionWiretap
74
107
  recognizer = UISwipeGestureRecognizer.alloc.initWithTarget(target, action: 'handle_gesture:')
75
108
  recognizer.direction = direction if direction
76
109
  recognizer.numberOfTouchesRequired = fingers if fingers
110
+ recognizer.delegate = delegate if delegate
77
111
  return recognizer
78
112
  end
79
113
 
@@ -88,12 +122,14 @@ module MotionWiretap
88
122
  fingers = nil
89
123
  min_fingers = nil
90
124
  max_fingers = nil
125
+ delegate = nil
91
126
 
92
127
  if fingers_or_options
93
128
  if fingers_or_options.is_a? Hash
94
- fingers = fingers_or_options[:fingers] || fingers
95
- min_fingers = fingers_or_options[:min_fingers] || min_fingers
96
- max_fingers = fingers_or_options[:max_fingers] || max_fingers
129
+ fingers = fingers_or_options[:fingers]
130
+ min_fingers = fingers_or_options[:min_fingers]
131
+ max_fingers = fingers_or_options[:max_fingers]
132
+ delegate = fingers_or_options[:delegate]
97
133
  else
98
134
  fingers = fingers_or_options
99
135
  end
@@ -106,6 +142,7 @@ module MotionWiretap
106
142
  recognizer = UIPanGestureRecognizer.alloc.initWithTarget(target, action: 'handle_gesture:')
107
143
  recognizer.maximumNumberOfTouches = min_fingers if min_fingers
108
144
  recognizer.minimumNumberOfTouches = max_fingers if max_fingers
145
+ recognizer.delegate = delegate if delegate
109
146
  return recognizer
110
147
  end
111
148
 
@@ -120,12 +157,14 @@ module MotionWiretap
120
157
  duration = nil
121
158
  taps = nil
122
159
  fingers = nil
160
+ delegate = nil
123
161
 
124
162
  if duration_or_options
125
163
  if duration_or_options.is_a? Hash
126
- duration = duration_or_options[:duration] || duration
127
- taps = duration_or_options[:taps] || taps
128
- fingers = duration_or_options[:fingers] || fingers
164
+ duration = duration_or_options[:duration]
165
+ taps = duration_or_options[:taps]
166
+ fingers = duration_or_options[:fingers]
167
+ delegate = duration_or_options[:delegate]
129
168
  else
130
169
  duration = duration_or_options
131
170
  end
@@ -135,6 +174,7 @@ module MotionWiretap
135
174
  recognizer.minimumPressDuration = duration if duration
136
175
  recognizer.numberOfTapsRequired = taps if taps
137
176
  recognizer.numberOfTouchesRequired = fingers if fingers
177
+ recognizer.delegate = delegate if delegate
138
178
  return recognizer
139
179
  end
140
180
 
@@ -32,7 +32,7 @@ module MotionWiretap
32
32
  @gesture_recognizers << recognizer
33
33
  end
34
34
 
35
- listen(&block)
35
+ listen(&block) if block
36
36
 
37
37
  return self
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module MotionWiretap
2
- VERSION = '1.1.6'
2
+ VERSION = '1.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-wiretap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  ReactiveCocoa is an amazing system, and RubyMotion could benefit from the