sugarcube 3.3.7 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/ios/sugarcube-constants/symbol.rb +19 -0
- data/lib/ios/sugarcube-gestures/gestures.rb +19 -7
- data/lib/version.rb +1 -1
- data/spec/ios/gestures_spec.rb +20 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c825347c6958710f5ee4933a8f1f0505b1c04df
|
4
|
+
data.tar.gz: f92835087ed01e21e55609e2b91deba8a6f7b83f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a20731556cd87e0a446650fac5e1d60528e7869f8a8d388e4e43610a33ea42f4e95a50af74a0f875d3e9995d40d7d5f6953347dab4770d78150b5cb35917be23
|
7
|
+
data.tar.gz: a1ace56fcca4ac03c2d8d62ce56dc74640cd1120c180946b3f09b90c084847dfae3d6f8d42578d4f1d94a37d803dbc6c9380e3a3e2040c6e946abd1184d4cb6f
|
data/README.md
CHANGED
@@ -440,6 +440,9 @@ view.on_pan(2) # minimum and maximum fingers required
|
|
440
440
|
view.on_pan(fingers: 2)
|
441
441
|
view.on_pan(min_fingers: 2, max_fingers: 3)
|
442
442
|
|
443
|
+
# If present, overrides fingers options and instead handles gestures originating at specified screen edges (UIScreenEdgePanGestureRecognizer)
|
444
|
+
view.on_pan(edges: [<list>]) # Some combination of [:left, :right, :top, :bottom, :all].
|
445
|
+
|
443
446
|
# `on_press` is a continuous event (it uses UILongPressGestureRecognizer), so
|
444
447
|
# you need to check the `gesture`:
|
445
448
|
view.on_press do |gesture|
|
@@ -248,6 +248,12 @@ class Symbol
|
|
248
248
|
def uigesturerecognizerstate
|
249
249
|
SugarCube.look_in(self, Symbol.uigesturerecognizerstate)
|
250
250
|
end
|
251
|
+
|
252
|
+
def uirectedge
|
253
|
+
SugarCube.look_in(self, Symbol.uirectedge)
|
254
|
+
end
|
255
|
+
|
256
|
+
|
251
257
|
alias uigesturestate uigesturerecognizerstate
|
252
258
|
|
253
259
|
class << self
|
@@ -324,6 +330,8 @@ class Symbol
|
|
324
330
|
|
325
331
|
attr :uigesturerecognizerstate
|
326
332
|
|
333
|
+
attr :uirectedge
|
334
|
+
|
327
335
|
end
|
328
336
|
|
329
337
|
@uidevice = {
|
@@ -892,4 +900,15 @@ class Symbol
|
|
892
900
|
recognized: UIGestureRecognizerStateRecognized,
|
893
901
|
}
|
894
902
|
|
903
|
+
|
904
|
+
@uirectedge = {
|
905
|
+
left: UIRectEdgeLeft,
|
906
|
+
right: UIRectEdgeRight,
|
907
|
+
top: UIRectEdgeTop,
|
908
|
+
bottom: UIRectEdgeBottom,
|
909
|
+
none: UIRectEdgeNone,
|
910
|
+
all: UIRectEdgeAll
|
911
|
+
}
|
912
|
+
|
913
|
+
|
895
914
|
end
|
@@ -121,14 +121,18 @@ class UIView
|
|
121
121
|
# @option options [Fixnum] :min_fingers Minimum number of fingers for gesture to be recognized
|
122
122
|
# @option options [Fixnum] :max_fingers Maximum number of fingers for gesture to be recognized
|
123
123
|
# @option options [Fixnum] :fingers If min_fingers or max_fingers is not assigned, this will be the default.
|
124
|
+
# @option options [Array] :edges Some combination of [:left, :right, :top, :bottom, :all]. If present, overrides fingers options and instead handles gestures originating at specified screen edges.
|
124
125
|
def on_pan(fingers_or_options=nil, &proc)
|
125
126
|
fingers = nil
|
127
|
+
edge_options = [:none]
|
126
128
|
min_fingers = nil
|
127
129
|
max_fingers = nil
|
130
|
+
recognizer = nil
|
128
131
|
|
129
132
|
if fingers_or_options
|
130
133
|
if fingers_or_options.is_a? Hash
|
131
134
|
fingers = fingers_or_options[:fingers] || fingers
|
135
|
+
edge_options = fingers_or_options[:edges] || edge_options
|
132
136
|
min_fingers = fingers_or_options[:min_fingers] || min_fingers
|
133
137
|
max_fingers = fingers_or_options[:max_fingers] || max_fingers
|
134
138
|
else
|
@@ -136,13 +140,21 @@ class UIView
|
|
136
140
|
end
|
137
141
|
end
|
138
142
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
143
|
+
if edge_options.uniq == [:none] # full view pan, possibly with finger options
|
144
|
+
# if fingers is assigned, but not min/max, assign it as a default
|
145
|
+
min_fingers ||= fingers
|
146
|
+
max_fingers ||= fingers
|
147
|
+
recognizer = UIPanGestureRecognizer.alloc.initWithTarget(self, action:'sugarcube_handle_gesture:')
|
148
|
+
recognizer.maximumNumberOfTouches = min_fingers if min_fingers
|
149
|
+
recognizer.minimumNumberOfTouches = max_fingers if max_fingers
|
150
|
+
else #edges option, finger options ignored
|
151
|
+
edges = :none.uirectedge
|
152
|
+
edge_options.each do | edge |
|
153
|
+
edges |= (edge.uirectedge || 0)
|
154
|
+
end
|
155
|
+
recognizer = UIScreenEdgePanGestureRecognizer.alloc.initWithTarget(self, action:'sugarcube_handle_gesture:')
|
156
|
+
recognizer.edges = edges
|
157
|
+
end
|
146
158
|
sugarcube_add_gesture(proc, recognizer)
|
147
159
|
end
|
148
160
|
|
data/lib/version.rb
CHANGED
data/spec/ios/gestures_spec.rb
CHANGED
@@ -69,7 +69,7 @@ describe 'Gestures' do
|
|
69
69
|
@view.gestureRecognizers.should.include?(gesture)
|
70
70
|
end
|
71
71
|
|
72
|
-
it 'should work with options' do
|
72
|
+
it 'should work with fingers options' do
|
73
73
|
gesture = @view.on_pan(min_fingers: 2, max_fingers: 2) do |gesture|
|
74
74
|
end
|
75
75
|
gesture.should.be.kind_of(UIPanGestureRecognizer)
|
@@ -77,6 +77,25 @@ describe 'Gestures' do
|
|
77
77
|
gesture.minimumNumberOfTouches.should == 2
|
78
78
|
@view.gestureRecognizers.should.include?(gesture)
|
79
79
|
end
|
80
|
+
|
81
|
+
it 'should work with edges option' do
|
82
|
+
gesture = @view.on_pan(edges: [:top, :left]) do |gesture|
|
83
|
+
end
|
84
|
+
gesture.should.be.kind_of(UIScreenEdgePanGestureRecognizer)
|
85
|
+
gesture.edges.should == (:left.uirectedge + :top.uirectedge)
|
86
|
+
@view.gestureRecognizers.should.include?(gesture)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should ignore :none edges option' do
|
90
|
+
gesture = @view.on_pan(edges: [:none], min_fingers: 2, max_fingers: 2) do |gesture|
|
91
|
+
end
|
92
|
+
gesture.should.be.kind_of(UIPanGestureRecognizer)
|
93
|
+
gesture.maximumNumberOfTouches.should == 2
|
94
|
+
gesture.minimumNumberOfTouches.should == 2
|
95
|
+
@view.gestureRecognizers.should.include?(gesture)
|
96
|
+
end
|
97
|
+
|
98
|
+
|
80
99
|
end
|
81
100
|
|
82
101
|
describe 'on_press' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: |
|
18
18
|
== Description
|
@@ -312,17 +312,17 @@ require_paths:
|
|
312
312
|
- lib
|
313
313
|
required_ruby_version: !ruby/object:Gem::Requirement
|
314
314
|
requirements:
|
315
|
-
- -
|
315
|
+
- - ">="
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
319
319
|
requirements:
|
320
|
-
- -
|
320
|
+
- - ">="
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: '0'
|
323
323
|
requirements: []
|
324
324
|
rubyforge_project:
|
325
|
-
rubygems_version: 2.4.5
|
325
|
+
rubygems_version: 2.4.5.1
|
326
326
|
signing_key:
|
327
327
|
specification_version: 4
|
328
328
|
summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully
|