sugarcube 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sugarcube-animations/caanimation.rb +14 -6
- data/lib/sugarcube-animations/uiview.rb +18 -5
- data/lib/sugarcube-constants/symbol.rb +9 -4
- data/lib/sugarcube/version.rb +1 -1
- data/spec/symbol_constants_spec.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd01b6a399450ae3f6505e720773a82d9eda7e7
|
4
|
+
data.tar.gz: e8d3ba59a5979aae34b4557a7d1e430967b73676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3030d35dc2928c73c4a92a25ab5eb3a342ae82d14310fcce3177027edc52152a23a77a151f1858aeaa16f92c300aa86ad482abde786b590eec9b3015c00fa634
|
7
|
+
data.tar.gz: fd8129000d4b66904a045e73962765168a4ba94f82291948fb2177635553eeb6314ad29b29956540b3fe5b306fbc55f98389776a0906bcde7b9674c7434f9dbf
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
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={},
|
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
|
-
|
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
|
-
|
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
|
-
|
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={},
|
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
|
-
|
442
|
-
|
443
|
-
none:
|
446
|
+
align_baselines: UIBaselineAdjustmentAlignBaselines,
|
447
|
+
align_centers: UIBaselineAdjustmentAlignCenters,
|
448
|
+
none: UIBaselineAdjustmentNone,
|
444
449
|
}
|
445
450
|
|
446
451
|
@uibordertype = {
|
data/lib/sugarcube/version.rb
CHANGED
@@ -109,8 +109,8 @@ describe "Symbol - constants" do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'should support `uibaselineadjustment`' do
|
112
|
-
:
|
113
|
-
:
|
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 `
|
713
|
-
should.raise(SugarCubeNotFoundException) { :definitely_doesnt_exist_i_am_really_sure_of_it.
|
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.
|
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-
|
14
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |
|
17
17
|
== Description
|