sugarcube 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.3.0)
4
+ sugarcube (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -12,7 +12,7 @@ class UIControl
12
12
  # button.on(:touch) { |sender,touch_event| my_code }
13
13
  def on(*events, &block)
14
14
  handler = SugarCube::UIControlCallbackHelper.new
15
- handler.callback = block
15
+ handler.callback = WeakRef.new(block)
16
16
 
17
17
  events.each do |event|
18
18
  event = event.uicontrolevent if event.respond_to?(:uicontrolevent)
@@ -66,7 +66,7 @@ private
66
66
  self.sugarcube_callbacks[notication] << NSNotificationCenter.defaultCenter.addObserverForName(notication,
67
67
  object: self,
68
68
  queue: NSOperationQueue.mainQueue,
69
- usingBlock: block)
69
+ usingBlock: WeakRef.new(block))
70
70
  end
71
71
 
72
72
  def _offEventNotification(nofication)
@@ -118,7 +118,7 @@ class UIView
118
118
  # @overload on_tap(taps)
119
119
  # @param taps [Fixnum] Number of taps
120
120
  # @overload on_tap(options)
121
- # @option options [Fixnum] :min_fingers Minimum umber of fingers for gesture to be recognized
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
124
  def on_pan(fingers_or_options=nil, &proc)
@@ -193,7 +193,7 @@ private
193
193
  self.addGestureRecognizer(recognizer)
194
194
 
195
195
  @sugarcube_recognizers = {} unless @sugarcube_recognizers
196
- @sugarcube_recognizers[recognizer] = proc
196
+ @sugarcube_recognizers[recognizer] = WeakRef.new(proc)
197
197
 
198
198
  recognizer
199
199
  end
@@ -152,21 +152,6 @@ class UIImage
152
152
  return sub_image
153
153
  end
154
154
 
155
- # Delegates to `scale_to_fill(position: :center)`
156
- def scale_to_fill(new_size)
157
- scale_to_fill(new_size, position: :center)
158
- end
159
-
160
- # Delegates to `scale_to_fill(position: :center, scale: scale)`
161
- def scale_to_fill(new_size, scale: scale)
162
- scale_to_fill(new_size, position: :center, scale: scale)
163
- end
164
-
165
- # Delegates to `scale_to_fill(new_size, position: position, scale: self.scale)`
166
- def scale_to_fill(new_size, position:position)
167
- scale_to_fill(new_size, position: position, scale: self.scale)
168
- end
169
-
170
155
  # Scales an image to fit within the given size, stretching one or both
171
156
  # dimensions so that it completely fills the area. The current aspect ratio
172
157
  # is maintained. If you want to place an image inside a container image, this
@@ -189,8 +174,11 @@ class UIImage
189
174
  # `topleft`, that'll work, too)
190
175
  # @param scale [Numeric] image scale
191
176
  # @return [UIImage]
192
- def scale_to_fill(new_size, position:position, scale:scale)
177
+ def scale_to_fill(new_size, options={})
193
178
  new_size = SugarCube::CoreGraphics::Size(new_size)
179
+ position = options[:position] || :center
180
+ scale = options[:scale] || self.scale
181
+
194
182
  my_size = self.size
195
183
  if new_size.width == my_size.width && new_size.height == my_size.height && self.scale == scale
196
184
  return self
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.3.0'
2
+ Version = '1.3.1'
3
3
  end
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: 1.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-10-09 00:00:00.000000000 Z
15
+ date: 2013-10-10 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: ! '== Description
18
18