sugarcube 1.6.0 → 1.6.1

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: 1e1417a3329f05a87872dd59e8472640896a337c
4
- data.tar.gz: 0e5f00b2c3c673b4ba29f3661ffd3bc5c27f1f58
3
+ metadata.gz: dfd01b6a399450ae3f6505e720773a82d9eda7e7
4
+ data.tar.gz: e8d3ba59a5979aae34b4557a7d1e430967b73676
5
5
  SHA512:
6
- metadata.gz: 47cbe203746a7c8cee85d0382542e72175fab5e8e9d61230b2decff908cb2a34abda874df732bdd770edcfcb02fe67778b4aea5ce70a5f248f8c96f6d317e2a9
7
- data.tar.gz: 9d5506c2fb6b8dfe7b3ec64538c8cdee291e77be03305d017010222e1515305d2d1bad5a44289574c7fd6fb94ba0182ecd0bf001c4e1d91854a875dee4b3d4a0
6
+ metadata.gz: 3030d35dc2928c73c4a92a25ab5eb3a342ae82d14310fcce3177027edc52152a23a77a151f1858aeaa16f92c300aa86ad482abde786b590eec9b3015c00fa634
7
+ data.tar.gz: fd8129000d4b66904a045e73962765168a4ba94f82291948fb2177635553eeb6314ad29b29956540b3fe5b306fbc55f98389776a0906bcde7b9674c7434f9dbf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sugarcube (1.6.0)
4
+ sugarcube (1.6.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,12 +17,12 @@ class CAAnimation
17
17
  def basic(key_path, options={}, &block)
18
18
  animation = CABasicAnimation.animationWithKeyPath(key_path)
19
19
  _sugarcube_apply_animation_options(animation, options)
20
+ fill_mode = options.fetch(:fill_mode, KCAFillModeForwards)
21
+ animation.fillMode = fill_mode
20
22
 
21
- if options.key?(:from) || options.key?(:to) || options.key?(:by)
22
- animation.fromValue = options[:from] if options.key?(:from)
23
- animation.toValue = options[:to] if options.key?(:to)
24
- animation.byValue = options[:by] if options.key?(:by)
25
- end
23
+ animation.fromValue = options[:from] if options.key?(:from)
24
+ animation.toValue = options[:to] if options.key?(:to)
25
+ animation.byValue = options[:by] if options.key?(:by)
26
26
 
27
27
  return animation
28
28
  end
@@ -42,7 +42,15 @@ class CAAnimation
42
42
  if options.key?(:values)
43
43
  animation.values = options[:values]
44
44
  elsif options.key?(:path)
45
- animation.path = options[:path]
45
+ path = options[:path]
46
+ if path.is_a?(UIBezierPath)
47
+ p = UIBezierPath.bezierPath
48
+ p.moveToPoint([0, 0])
49
+ p.addCurveToPoint([1, 0], controlPoint1: [0.9, 0], controlPoint2: [0.1, 0])
50
+
51
+ path = path.CGPath
52
+ end
53
+ animation.path = path
46
54
  end
47
55
 
48
56
  return animation
@@ -135,6 +135,15 @@ class UIView
135
135
  return self
136
136
  end
137
137
 
138
+ # Just calls layoutIfNeeded before and after constraints are applied
139
+ def animate_constraints(options={}, &animations)
140
+ self.layoutIfNeeded
141
+ animations.call
142
+ UIView.animate(options) do
143
+ self.layoutIfNeeded
144
+ end
145
+ end
146
+
138
147
  # Changes the layer opacity.
139
148
  def fade(options={}, more_options={}, &after)
140
149
  if options.is_a? Numeric
@@ -535,20 +544,24 @@ class UIView
535
544
 
536
545
  # Moves the view backwards, similar to what Google has been doing a lot
537
546
  # recently
538
- def back_fiend!(options={}, more_options={})
547
+ def back_fiend!(options={}, &after)
539
548
  scale = options[:scale] || 0.5
540
549
  perspective = options[:perspective] || -0.0005
541
550
  size = options[:size] || -140
542
551
 
543
- UIView.animation_chain(duration:200.millisecs, options:UIViewAnimationOptionCurveLinear) {
552
+ options[:duration] ||= 200.millisecs
553
+ options[:curve] ||= UIViewAnimationOptionCurveLinear
554
+
555
+ UIView.animation_chain(options) do
544
556
  self.layer.transform = CATransform3DTranslate(CATransform3DScale(CATransform3D.new(1,0,0,0, 0,1,0,perspective, 0,0,1,0, 0,0,0,1), scale, scale, scale), 0, size, 0)
545
- }.and_then(duration:300.millisecs, options:UIViewAnimationOptionCurveLinear) {
557
+ end.and_then(duration:300.millisecs, options:UIViewAnimationOptionCurveLinear) do
546
558
  self.layer.transform = CATransform3DTranslate(CATransform3DScale(CATransform3DIdentity, scale, scale, scale), 0, size, 0)
547
- }.start
559
+ end.and_then(&after).start
548
560
  end
549
561
 
550
562
  # restores the layer after a call to 'back_fiend!'
551
- def forward_fiend!(options={}, more_options={})
563
+ def forward_fiend!(options={}, &after)
564
+ options[:after] ||= after
552
565
  UIView.animate(options) do
553
566
  self.layer.transform = CATransform3DIdentity
554
567
  end
@@ -71,7 +71,7 @@ class Symbol
71
71
  end
72
72
 
73
73
  def uibaselineadjustment
74
- SugarCube.look_in(self, Symbol.uibaselineadjustment)
74
+ SugarCube.look_in(self, Symbol.uibaselineadjustment, Symbol.uibaselineadjustment__deprecated)
75
75
  end
76
76
  alias uibaseline uibaselineadjustment
77
77
 
@@ -251,6 +251,7 @@ class Symbol
251
251
  attr :nstextalignment
252
252
  attr :uilinebreakmode
253
253
  attr :uilinebreakmode__deprecated
254
+ attr :uibaselineadjustment__deprecated
254
255
  attr :uibaselineadjustment
255
256
  attr :uibordertype
256
257
  attr :nsdatestyle
@@ -437,10 +438,14 @@ class Symbol
437
438
  middle_truncation: UILineBreakModeMiddleTruncation,
438
439
  }
439
440
 
441
+ @uibaselineadjustment__deprecated = {
442
+ alignbaselines: :align_baselines,
443
+ aligncenters: :align_centers,
444
+ }
440
445
  @uibaselineadjustment = {
441
- alignbaselines: UIBaselineAdjustmentAlignBaselines,
442
- aligncenters: UIBaselineAdjustmentAlignCenters,
443
- none: UIBaselineAdjustmentNone,
446
+ align_baselines: UIBaselineAdjustmentAlignBaselines,
447
+ align_centers: UIBaselineAdjustmentAlignCenters,
448
+ none: UIBaselineAdjustmentNone,
444
449
  }
445
450
 
446
451
  @uibordertype = {
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '1.6.0'
2
+ Version = '1.6.1'
3
3
  end
@@ -109,8 +109,8 @@ describe "Symbol - constants" do
109
109
  end
110
110
 
111
111
  it 'should support `uibaselineadjustment`' do
112
- :alignbaselines.uibaselineadjustment.should == UIBaselineAdjustmentAlignBaselines
113
- :aligncenters.uibaselineadjustment.should == UIBaselineAdjustmentAlignCenters
112
+ :align_baselines.uibaselineadjustment.should == UIBaselineAdjustmentAlignBaselines
113
+ :align_centers.uibaselineadjustment.should == UIBaselineAdjustmentAlignCenters
114
114
  :none.uibaselineadjustment.should == UIBaselineAdjustmentNone
115
115
  end
116
116
 
@@ -517,6 +517,11 @@ describe "Symbol - constants" do
517
517
  SugarCube::Legacy.log.length.should > 0
518
518
  end
519
519
 
520
+ it 'should support `uibaselineadjustment`' do
521
+ :alignbaselines.uibaselineadjustment.should == UIBaselineAdjustmentAlignBaselines
522
+ :aligncenters.uibaselineadjustment.should == UIBaselineAdjustmentAlignCenters
523
+ end
524
+
520
525
  it 'should support `uicontrolevent`' do
521
526
  :changed.uicontrolevent.should == :change.uicontrolevent
522
527
  SugarCube::Legacy.log.length.should > 0
@@ -709,8 +714,8 @@ describe "Symbol - constants" do
709
714
  should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.uikeyboardtype }
710
715
  end
711
716
 
712
- it 'should not find nonexistant `uitextalignment`' do
713
- should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.uitextalignment }
717
+ it 'should not find nonexistant `nstextalignment`' do
718
+ should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.nstextalignment }
714
719
  end
715
720
 
716
721
  it 'should not find nonexistant `uilinebreakmode`' 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: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-04-23 00:00:00.000000000 Z
14
+ date: 2014-05-13 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |
17
17
  == Description