geomotion 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a59f370cd3dbf8f042b2287527e6126964307b21
4
+ data.tar.gz: 25963a639b7b2f6176751b734b56453cd3400138
5
+ SHA512:
6
+ metadata.gz: 6918464558d95c7e38b1b99c96ff7a4c7702d4db03c5e4c4254193638a1d160c39d2a4a7142446d612f655807448167abe0a8b56340dd32ea652f25437cb19aa
7
+ data.tar.gz: 11cac391016820c7eeebdde5bd08129813fdddf3d7df87215e365ed7c546f41cdc42c397b162a3135f6e0dc50550bf5cf50acc250a9639440320443c673e74dc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geomotion (0.14.0)
4
+ geomotion (0.15.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -215,6 +215,13 @@ frame.beside(width: 20, down: 10, height: 20)
215
215
 
216
216
  frame.below(grow_width: 10, grow_up: 5)
217
217
  # => [[0, 15], [40, 25]]
218
+
219
+ # convert to NSValue, for use in NSCoding or where an Objective-C object is
220
+ # needed. CGRect is a "boxed" object in RubyMotion, and in Objective-C it is a
221
+ # C-struct and so can't be stored in an NSArray, for example.
222
+ NSValue.valueWithCGRect(CGRect.new([0, 10], [10, 20]))
223
+ # =>
224
+ CGRect.new([0, 10], [10, 20]).to_ns_value
218
225
  ```
219
226
 
220
227
  ### CGSize
@@ -242,6 +249,12 @@ size + CGPoint.make(x: 10, y: 30)
242
249
  # Combine with CGPoint
243
250
  size.rect_at_point CGPoint.make(x: 10, y: 30)
244
251
  => CGRect(10, 30, 50, 20)
252
+
253
+ # convert to NSValue, for use in NSCoding or where an Objective-C object is
254
+ # needed.
255
+ NSValue.valueWithCGSize(CGSize.new(0, 10))
256
+ # =>
257
+ CGSize.new(0, 10).to_ns_value
245
258
  ```
246
259
 
247
260
  ### CGPoint
@@ -283,6 +296,12 @@ point.distance_to(CGPoint.make(x: 13, y:104))
283
296
  # (up 10, over 10)
284
297
  point.angle_to(CGPoint.make(x: 20, y:110))
285
298
  => 0.785398163397 (pi/4)
299
+
300
+ # convert to NSValue, for use in NSCoding or where an Objective-C object is
301
+ # needed.
302
+ NSValue.valueWithCGPoint(CGPoint.new(0, 10))
303
+ # =>
304
+ CGPoint.new(0, 10).to_ns_value
286
305
  ```
287
306
 
288
307
  ### CGAffineTransform
@@ -330,6 +349,12 @@ CGAffineTransform.shear(0, 0.5) # in y direction
330
349
 
331
350
  # or you can chain these methods
332
351
  CGAffineTransform.identity.translate(10, 10).scale(2).rotate(Math::PI / 4)
352
+
353
+ # convert to NSValue, for use in NSCoding or where an Objective-C object is
354
+ # needed.
355
+ NSValue.valueWithCGAffineTransform(CGAffineTransform.translate(0, 10))
356
+ # =>
357
+ CGAffineTransform.translate(0, 10).to_ns_value
333
358
  ```
334
359
 
335
360
  ###### Shearing
@@ -383,6 +408,11 @@ CATransform3D.perspective(0, 0.002) # "rotates" around the y-axis
383
408
 
384
409
  # or you can chain these methods
385
410
  CATransform3D.identity.translate(10, 10, 10).scale(2).rotate(Math::PI / 4)
411
+
412
+ # convert to NSValue, for use in NSCoding or CAKeyframeAnimation#values
413
+ NSValue.valueWithCATransform3D(CATransform3D.translate(0, 10, 0))
414
+ # =>
415
+ CATransform3D.translate(0, 10, 0).to_ns_value
386
416
  ```
387
417
 
388
418
  ###### Perspective
@@ -216,8 +216,17 @@ class CATransform3D
216
216
  self.concat CATransform3D.perspective(x, y)
217
217
  end
218
218
 
219
+ def to_ns_value
220
+ NSValue.valueWithCATransform3D(self)
221
+ end
222
+
219
223
  def to_a
220
224
  [self.m11, self.m12, self.m13, self.m14, self.m21, self.m22, self.m23, self.m24, self.m31, self.m32, self.m33, self.m34, self.m41, self.m42, self.m43, self.m44]
221
225
  end
222
226
 
227
+ private
228
+ def to_ary
229
+ to_a
230
+ end
231
+
223
232
  end
@@ -178,4 +178,13 @@ class CGAffineTransform
178
178
  [self.a, self.b, self.c, self.d, self.tx, self.ty]
179
179
  end
180
180
 
181
+ def to_ns_value
182
+ NSValue.valueWithCGAffineTransform(self)
183
+ end
184
+
185
+ private
186
+ def to_ary
187
+ to_a
188
+ end
189
+
181
190
  end
@@ -10,7 +10,7 @@ class CGPoint
10
10
  # point.rect_of_size(size) # => CGRect([0, 10], [100, 100])
11
11
  # point.rect_of_size([10, 20]) # => CGRect([10, 20], [100, 100])
12
12
  def rect_of_size(size)
13
- CGRect.new([self.x, self.y], size)
13
+ CGRect.new(self, size)
14
14
  end
15
15
 
16
16
  # modified points
@@ -98,6 +98,10 @@ class CGPoint
98
98
  "#{self.class.name}(#{self.x}, #{self.y})"
99
99
  end
100
100
 
101
+ def to_ns_value
102
+ NSValue.valueWithCGPoint(self)
103
+ end
104
+
101
105
  private
102
106
  # this method allows us to do parallel assignment of #x and #y
103
107
  def to_ary
@@ -234,11 +234,12 @@ class CGRect
234
234
  NSLog("Using the default value of `0` in `CGRect#left` is deprecated.")
235
235
  dist = 0
236
236
  end
237
+ raise "You cannot specify `:left` in `CGRect#left`" if options.key?(:left)
237
238
  raise "You must specify an amount in `CGRect#left`" unless dist.is_a?(Numeric)
238
239
 
239
240
  self.apply({
240
241
  left: dist
241
- }.merge(options))
242
+ }).apply(options)
242
243
  end
243
244
 
244
245
  def right(dist=nil, options={})
@@ -246,11 +247,12 @@ class CGRect
246
247
  NSLog("Using the default value of `0` in `CGRect#right` is deprecated.")
247
248
  dist = 0
248
249
  end
250
+ raise "You cannot specify `:right` in `CGRect#right`" if options.key?(:right)
249
251
  raise "You must specify an amount in `CGRect#right`" unless dist.is_a?(Numeric)
250
252
 
251
253
  self.apply({
252
254
  right: dist
253
- }.merge(options))
255
+ }).apply(options)
254
256
  end
255
257
 
256
258
  def up(dist=nil, options={})
@@ -258,11 +260,12 @@ class CGRect
258
260
  NSLog("Using the default value of `0` in `CGRect#up` is deprecated.")
259
261
  dist = 0
260
262
  end
263
+ raise "You cannot specify `:up` in `CGRect#up`" if options.key?(:up)
261
264
  raise "You must specify an amount in `CGRect#up`" unless dist.is_a?(Numeric)
262
265
 
263
266
  self.apply({
264
267
  up: dist
265
- }.merge(options))
268
+ }).apply(options)
266
269
  end
267
270
 
268
271
  def down(dist=nil, options={})
@@ -270,43 +273,48 @@ class CGRect
270
273
  NSLog("Using the default value of `0` in `CGRect#down` is deprecated.")
271
274
  dist = 0
272
275
  end
276
+ raise "You cannot specify `:down` in `CGRect#down`" if options.key?(:down)
273
277
  raise "You must specify an amount in `CGRect#down`" unless dist.is_a?(Numeric)
274
278
 
275
279
  self.apply({
276
280
  down: dist
277
- }.merge(options))
281
+ }).apply(options)
278
282
  end
279
283
 
280
284
  def wider(dist, options={})
285
+ raise "You cannot specify `:width` in `CGRect#width`" if options.key?(:width)
281
286
  raise "You must specify an amount in `CGRect#wider`" unless dist.is_a?(Numeric)
282
287
 
283
288
  self.apply({
284
289
  wider: dist
285
- }.merge(options))
290
+ }).apply(options)
286
291
  end
287
292
 
288
293
  def thinner(dist, options={})
294
+ raise "You cannot specify `:thinner` in `CGRect#thinner`" if options.key?(:thinner)
289
295
  raise "You must specify an amount in `CGRect#thinner`" unless dist.is_a?(Numeric)
290
296
 
291
297
  self.apply({
292
298
  thinner: dist
293
- }.merge(options))
299
+ }).apply(options)
294
300
  end
295
301
 
296
302
  def taller(dist, options={})
303
+ raise "You cannot specify `:taller` in `CGRect#taller`" if options.key?(:taller)
297
304
  raise "You must specify an amount in `CGRect#taller`" unless dist.is_a?(Numeric)
298
305
 
299
306
  self.apply({
300
307
  taller: dist
301
- }.merge(options))
308
+ }).apply(options)
302
309
  end
303
310
 
304
311
  def shorter(dist, options={})
312
+ raise "You cannot specify `:shorter` in `CGRect#shorter`" if options.key?(:shorter)
305
313
  raise "You must specify an amount in `CGRect#shorter`" unless dist.is_a?(Numeric)
306
314
 
307
315
  self.apply({
308
316
  shorter: dist
309
- }.merge(options))
317
+ }).apply(options)
310
318
  end
311
319
 
312
320
  # adjacent rects
@@ -317,7 +325,7 @@ class CGRect
317
325
  height = options[:height] || self.size.height
318
326
  self.apply({
319
327
  up: height + margin
320
- }.merge(options))
328
+ }).apply(options)
321
329
  end
322
330
 
323
331
  def below(margin = 0, options={})
@@ -326,7 +334,7 @@ class CGRect
326
334
 
327
335
  self.apply({
328
336
  down: self.size.height + margin
329
- }.merge(options))
337
+ }).apply(options)
330
338
  end
331
339
 
332
340
  def before(margin = 0, options={})
@@ -336,7 +344,7 @@ class CGRect
336
344
  width = options[:width] || self.size.width
337
345
  self.apply({
338
346
  left: width + margin
339
- }.merge(options))
347
+ }).apply(options)
340
348
  end
341
349
 
342
350
  def beside(margin = 0, options={})
@@ -345,7 +353,7 @@ class CGRect
345
353
 
346
354
  self.apply({
347
355
  right: self.size.width + margin
348
- }.merge(options))
356
+ }).apply(options)
349
357
  end
350
358
  alias after beside
351
359
 
@@ -361,9 +369,9 @@ class CGRect
361
369
  self.apply({
362
370
  x: offset.x + margin,
363
371
  y: offset.y,
372
+ width: width,
364
373
  height: self.size.height,
365
- width: width
366
- }.merge(options))
374
+ }).apply(options)
367
375
  end
368
376
 
369
377
  # Create a rect inside the receiver, on the right side. If `margin` is
@@ -376,9 +384,9 @@ class CGRect
376
384
  self.apply({
377
385
  x: offset.x + self.size.width - width - margin,
378
386
  y: offset.y,
387
+ width: width,
379
388
  height: self.size.height,
380
- width: width
381
- }.merge(options))
389
+ }).apply(options)
382
390
  end
383
391
 
384
392
  # Create a rect inside the receiver, on the top side. If `margin` is
@@ -392,8 +400,8 @@ class CGRect
392
400
  x: offset.x,
393
401
  y: offset.y + margin,
394
402
  width: self.size.width,
395
- height: height
396
- }.merge(options))
403
+ height: height,
404
+ }).apply(options)
397
405
  end
398
406
 
399
407
  # Create a rect inside the receiver, on the bottom side. If `margin` is
@@ -407,8 +415,8 @@ class CGRect
407
415
  x: offset.x,
408
416
  y: offset.y + self.size.height - height - margin,
409
417
  width: self.size.width,
410
- height: height
411
- }.merge(options))
418
+ height: height,
419
+ }).apply(options)
412
420
  end
413
421
 
414
422
  # positions
@@ -421,10 +429,6 @@ private
421
429
  end
422
430
  end
423
431
 
424
- def to_ary
425
- [self.origin, self.size]
426
- end
427
-
428
432
  public
429
433
  def center(absolute = false)
430
434
  cgrect_offset(absolute) + CGPoint.new(self.size.width / 2, self.size.height / 2)
@@ -467,6 +471,10 @@ public
467
471
  CGRect.new([self.origin.x.round, self.origin.y.round], [self.size.width.round, self.size.height.round])
468
472
  end
469
473
 
474
+ def integral
475
+ CGRectIntegral(self)
476
+ end
477
+
470
478
  def centered_in(rect, absolute = false)
471
479
  self.size.centered_in(rect, absolute)
472
480
  end
@@ -540,21 +548,23 @@ public
540
548
  alias grow_right wider
541
549
 
542
550
  def grow_left(amount, options={})
551
+ raise "You cannot specify `:grow_left` in `CGRect#grow_left`" if options.key?(:grow_left)
543
552
  raise "You must specify an amount in `CGRect#grow_left`" unless amount.is_a?(Numeric)
544
553
 
545
554
  self.apply({
546
555
  grow_left: amount
547
- }.merge(options))
556
+ }).apply(options)
548
557
  end
549
558
 
550
559
  alias grow_down taller
551
560
 
552
561
  def grow_up(amount, options={})
562
+ raise "You cannot specify `:grow_up` in `CGRect#grow_up`" if options.key?(:grow_up)
553
563
  raise "You must specify an amount in `CGRect#grow_up`" unless amount.is_a?(Numeric)
554
564
 
555
565
  self.apply({
556
566
  grow_up: amount
557
- }.merge(options))
567
+ }).apply(options)
558
568
  end
559
569
 
560
570
  def grow_width(amount, options={})
@@ -579,21 +589,23 @@ public
579
589
  alias shrink_left thinner
580
590
 
581
591
  def shrink_right(amount, options={})
592
+ raise "You cannot specify `:shrink_right` in `CGRect#shrink_right`" if options.key?(:shrink_right)
582
593
  raise "You must specify an amount in `CGRect#shrink_right`" unless amount.is_a?(Numeric)
583
594
 
584
595
  self.apply({
585
596
  shrink_right: amount
586
- }.merge(options))
597
+ }).apply(options)
587
598
  end
588
599
 
589
600
  alias shrink_up shorter
590
601
 
591
602
  def shrink_down(amount, options={})
603
+ raise "You cannot specify `:shrink_down` in `CGRect#shrink_down`" if options.key?(:shrink_down)
592
604
  raise "You must specify an amount in `CGRect#shrink_down`" unless amount.is_a?(Numeric)
593
605
 
594
606
  self.apply({
595
607
  shrink_down: amount
596
- }.merge(options))
608
+ }).apply(options)
597
609
  end
598
610
 
599
611
  def shrink_width(amount, options={})
@@ -652,4 +664,14 @@ public
652
664
  "#{self.class.name}([#{self.origin.x}, #{self.origin.y}], [#{self.size.width}, #{self.size.height}])"
653
665
  end
654
666
 
667
+ def to_ns_value
668
+ NSValue.valueWithCGRect(self)
669
+ end
670
+
671
+ private
672
+
673
+ def to_ary
674
+ [self.origin, self.size]
675
+ end
676
+
655
677
  end
@@ -98,6 +98,10 @@ class CGSize
98
98
  "#{self.class.name}(#{self.width}, #{self.height})"
99
99
  end
100
100
 
101
+ def to_ns_value
102
+ NSValue.valueWithCGSize(self)
103
+ end
104
+
101
105
  private
102
106
  def to_ary
103
107
  [self.width, self.height]
@@ -1,3 +1,3 @@
1
1
  module Geomotion
2
- VERSION = "0.14.0"
2
+ VERSION = "0.15.0"
3
3
  end
@@ -172,25 +172,25 @@ describe "CATransform3D" do
172
172
  end
173
173
 
174
174
  it "should work with transform options (scale)" do
175
- CATransform3D.make(scale: [2, 3, 4]).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,0,0,0,1)
175
+ CATransform3D.make(scale: [2, 3, 4]).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 0,0,0,1)
176
176
  end
177
177
 
178
178
  it "should work with transform options (translate)" do
179
- CATransform3D.make(translate: [10, 20, 30]).should == CATransform3D.new(1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,10,20,30,1)
179
+ CATransform3D.make(translate: [10, 20, 30]).should == CATransform3D.new(1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,30,1)
180
180
  end
181
181
 
182
182
  it "should work with transform options (rotate)" do
183
183
  transform = CATransform3D.make(rotate: Math::PI).to_a.map { |v| v.round(3) }
184
- CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0 ,0,-1,0,0 ,0,0,1,0 ,0,0,0,1)
184
+ CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1)
185
185
  end
186
186
 
187
187
  it "should work with transform options (scale + translate)" do
188
- CATransform3D.make(scale: [2, 3, 4], translate: [10, 20, 30]).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,10,20,30,1)
188
+ CATransform3D.make(scale: [2, 3, 4], translate: [10, 20, 30]).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 10,20,30,1)
189
189
  end
190
190
 
191
191
  it "should work with transform options (scale + translate + rotation)" do
192
192
  transform = CATransform3D.make(scale: [2, 3, 4], rotate: Math::PI, translate: [10, 20, 30]).to_a.map { |v| v.round(3) }
193
- CATransform3D.new(*transform).should == CATransform3D.new(-2,0,0,0 ,0,-3,0,0 ,0,0,4,0 ,10,20,30,1)
193
+ CATransform3D.new(*transform).should == CATransform3D.new(-2,0,0,0, 0,-3,0,0, 0,0,4,0, 10,20,30,1)
194
194
  end
195
195
 
196
196
  end
@@ -225,12 +225,12 @@ describe "CATransform3D" do
225
225
 
226
226
  it "should work as a factory (z-axis)" do
227
227
  transform = CATransform3D.rotate(Math::PI, 0, 0, 1).to_a.map { |v| v.round(3) }
228
- CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0 ,0,-1,0,0 ,0,0,1,0 ,0,0,0,1)
228
+ CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1)
229
229
  end
230
230
 
231
231
  it "should work as a factory (default)" do
232
232
  transform = CATransform3D.rotate(Math::PI).to_a.map { |v| v.round(3) }
233
- CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0 ,0,-1,0,0 ,0,0,1,0 ,0,0,0,1)
233
+ CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1)
234
234
  end
235
235
 
236
236
  it "should work as an instance method (x-axis)" do
@@ -245,12 +245,12 @@ describe "CATransform3D" do
245
245
 
246
246
  it "should work as an instance method (z-axis)" do
247
247
  transform = CATransform3D.identity.rotate(Math::PI, 0, 0, 1).to_a.map { |v| v.round(3) }
248
- CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0 ,0,-1,0,0 ,0,0,1,0 ,0,0,0,1)
248
+ CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1)
249
249
  end
250
250
 
251
251
  it "should work as an instance method (default)" do
252
252
  transform = CATransform3D.identity.rotate(Math::PI).to_a.map { |v| v.round(3) }
253
- CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0 ,0,-1,0,0 ,0,0,1,0 ,0,0,0,1)
253
+ CATransform3D.new(*transform).should == CATransform3D.new(-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1)
254
254
  end
255
255
 
256
256
  end
@@ -258,27 +258,27 @@ describe "CATransform3D" do
258
258
  describe ".scale" do
259
259
 
260
260
  it "should work as a factory with one argument" do
261
- CATransform3D.scale(2).should == CATransform3D.new(2,0,0,0 ,0,2,0,0 ,0,0,1,0 ,0,0,0,1)
261
+ CATransform3D.scale(2).should == CATransform3D.new(2,0,0,0, 0,2,0,0, 0,0,1,0, 0,0,0,1)
262
262
  end
263
263
 
264
264
  it "should work as a factory with three arguments" do
265
- CATransform3D.scale(2, 3, 4).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,0,0,0,1)
265
+ CATransform3D.scale(2, 3, 4).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 0,0,0,1)
266
266
  end
267
267
 
268
268
  it "should work as a factory with one array" do
269
- CATransform3D.scale([2, 3, 4]).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,0,0,0,1)
269
+ CATransform3D.scale([2, 3, 4]).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 0,0,0,1)
270
270
  end
271
271
 
272
272
  it "should work as an instance method with one argument" do
273
- CATransform3D.identity.scale(2).should == CATransform3D.new(2,0,0,0 ,0,2,0,0 ,0,0,1,0 ,0,0,0,1)
273
+ CATransform3D.identity.scale(2).should == CATransform3D.new(2,0,0,0, 0,2,0,0, 0,0,1,0, 0,0,0,1)
274
274
  end
275
275
 
276
276
  it "should work as an instance method with three arguments" do
277
- CATransform3D.identity.scale(2, 3, 4).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,0,0,0,1)
277
+ CATransform3D.identity.scale(2, 3, 4).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 0,0,0,1)
278
278
  end
279
279
 
280
280
  it "should work as an instance method with one array" do
281
- CATransform3D.identity.scale([2, 3, 4]).should == CATransform3D.new(2,0,0,0 ,0,3,0,0 ,0,0,4,0 ,0,0,0,1)
281
+ CATransform3D.identity.scale([2, 3, 4]).should == CATransform3D.new(2,0,0,0, 0,3,0,0, 0,0,4,0, 0,0,0,1)
282
282
  end
283
283
 
284
284
  end
@@ -286,19 +286,19 @@ describe "CATransform3D" do
286
286
  describe ".translate" do
287
287
 
288
288
  it "should work as a factory with three arguments" do
289
- CATransform3D.translate(10, 20, 30).should == CATransform3D.new(1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,10,20,30,1)
289
+ CATransform3D.translate(10, 20, 30).should == CATransform3D.new(1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,30,1)
290
290
  end
291
291
 
292
292
  it "should work as a factory with one array" do
293
- CATransform3D.translate([10, 20, 30]).should == CATransform3D.new(1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,10,20,30,1)
293
+ CATransform3D.translate([10, 20, 30]).should == CATransform3D.new(1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,30,1)
294
294
  end
295
295
 
296
296
  it "should work as an instance method with three arguments" do
297
- CATransform3D.identity.translate(10, 20, 30).should == CATransform3D.new(1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,10,20,30,1)
297
+ CATransform3D.identity.translate(10, 20, 30).should == CATransform3D.new(1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,30,1)
298
298
  end
299
299
 
300
300
  it "should work as an instance method with one array" do
301
- CATransform3D.identity.translate([10, 20, 30]).should == CATransform3D.new(1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,10,20,30,1)
301
+ CATransform3D.identity.translate([10, 20, 30]).should == CATransform3D.new(1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,30,1)
302
302
  end
303
303
 
304
304
  end
@@ -322,24 +322,31 @@ describe "CATransform3D" do
322
322
  it "should support concat" do
323
323
  t1 = CATransform3D.translate(10, 20, 30)
324
324
  t2 = CATransform3D.scale(2)
325
- t1.concat(t2).should == CATransform3D.new(2,0,0,0 ,0,2,0,0 ,0,0,1,0 ,20,40,30,1)
325
+ t1.concat(t2).should == CATransform3D.new(2,0,0,0, 0,2,0,0, 0,0,1,0, 20,40,30,1)
326
326
  end
327
327
 
328
328
  it "should support invert" do
329
329
  t1 = CATransform3D.scale(2)
330
- t1.invert.should == CATransform3D.new(0.5,0,0,0 ,0,0.5,0,0 ,0,0,1,0 ,0,0,0,1)
330
+ t1.invert.should == CATransform3D.new(0.5,0,0,0, 0,0.5,0,0, 0,0,1,0, 0,0,0,1)
331
331
  end
332
332
 
333
333
  it "should support to_affine_transform" do
334
- t1 = CATransform3D.new(2,0,0,0 ,0,2,0,0 ,0,0,2,0 ,0,0,0,1)
334
+ t1 = CATransform3D.new(2,0,0,0, 0,2,0,0, 0,0,2,0, 0,0,0,1)
335
335
  t1.to_affine_transform.should == CGAffineTransformMake(2, 0, 0, 2, 0, 0)
336
336
  end
337
337
 
338
338
  it 'should support to_a' do
339
339
  t1 = CATransform3D.identity
340
- t1.to_a.should == [1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,0,0,0,1]
340
+ t1.to_a.should == [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
341
341
  end
342
342
 
343
343
  end
344
344
 
345
+ describe '#to_ns_value' do
346
+ it 'should convert to NSValue' do
347
+ val = CATransform3D.new(0.5,0,0,0, 0,0.5,0,0, 0,0,1,0, 0,0,0,1).to_ns_value
348
+ val.should.be.kind_of(NSValue)
349
+ end
350
+ end
351
+
345
352
  end
@@ -244,4 +244,11 @@ describe "CGAffineTransform" do
244
244
 
245
245
  end
246
246
 
247
+ describe '#to_ns_value' do
248
+ it 'should convert to NSValue' do
249
+ val = CGAffineTransform.new(1, 0, 0, 1, 0, 0).to_ns_value
250
+ val.should.be.kind_of(NSValue)
251
+ end
252
+ end
253
+
247
254
  end
@@ -154,6 +154,13 @@ describe "CGPoint" do
154
154
  end
155
155
  end
156
156
 
157
+ describe '#to_ns_value' do
158
+ it 'should convert to NSValue' do
159
+ val = CGPoint.new(0, 0).to_ns_value
160
+ val.should.be.kind_of(NSValue)
161
+ end
162
+ end
163
+
157
164
  describe "#to_ary" do
158
165
  it "should allow parallel assigment" do
159
166
  x, y = @point
@@ -161,4 +168,5 @@ describe "CGPoint" do
161
168
  y.should == 20.0
162
169
  end
163
170
  end
171
+
164
172
  end
@@ -667,6 +667,16 @@ describe "CGRect" do
667
667
  end
668
668
  end
669
669
 
670
+ describe "#integral" do
671
+ it "works" do
672
+ rect = CGRect.make(x: 10.4, y: 20.5, width: 300.4, height: 400.5).integral
673
+ rect.origin.x.should == 10
674
+ rect.origin.y.should == 20
675
+ rect.size.width.should == 301
676
+ rect.size.height.should == 401
677
+ end
678
+ end
679
+
670
680
  describe "#centered_in" do
671
681
  it "works" do
672
682
  outer_rect = CGRect.make(width: 100, height: 100)
@@ -1128,6 +1138,13 @@ describe "CGRect" do
1128
1138
  end
1129
1139
  end
1130
1140
 
1141
+ describe '#to_ns_value' do
1142
+ it 'should convert to NSValue' do
1143
+ val = CGRect.new([0, 0], [0, 0]).to_ns_value
1144
+ val.should.be.kind_of(NSValue)
1145
+ end
1146
+ end
1147
+
1131
1148
  describe "#to_ary" do
1132
1149
  it "should allow parallel assigment" do
1133
1150
  position, size = @rect
@@ -149,6 +149,13 @@ describe "CGSize" do
149
149
  end
150
150
  end
151
151
 
152
+ describe '#to_ns_value' do
153
+ it 'should convert to NSValue' do
154
+ val = CGSize.new(0, 0).to_ns_value
155
+ val.should.be.kind_of(NSValue)
156
+ end
157
+ end
158
+
152
159
  describe "#to_ary" do
153
160
  it "should allow parallel assigment" do
154
161
  width, height = @size
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geomotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
5
- prerelease:
4
+ version: 0.15.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Clay Allsopp
@@ -10,19 +9,22 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-01-26 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake
17
- requirement: &70274280072720 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :development
24
22
  prerelease: false
25
- version_requirements: *70274280072720
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
26
28
  description: A RubyMotion Geometry Wrapper
27
29
  email:
28
30
  - clay@usepropeller.com
@@ -60,27 +62,26 @@ files:
60
62
  homepage: https://github.com/clayallsopp/geomotion
61
63
  licenses:
62
64
  - MIT
65
+ metadata: {}
63
66
  post_install_message:
64
67
  rdoc_options: []
65
68
  require_paths:
66
69
  - lib
67
70
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
71
  requirements:
70
- - - ! '>='
72
+ - - '>='
71
73
  - !ruby/object:Gem::Version
72
74
  version: '0'
73
75
  required_rubygems_version: !ruby/object:Gem::Requirement
74
- none: false
75
76
  requirements:
76
- - - ! '>='
77
+ - - '>='
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
81
  rubyforge_project:
81
- rubygems_version: 1.8.11
82
+ rubygems_version: 2.0.14
82
83
  signing_key:
83
- specification_version: 3
84
+ specification_version: 4
84
85
  summary: A RubyMotion Geometry Wrapper
85
86
  test_files:
86
87
  - spec/ca_transform_3d_spec.rb