teacup 1.0.2 → 1.0.3
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.
- data/Gemfile.lock +1 -1
- data/Rakefile +0 -1
- data/lib/teacup/calculations.rb +19 -0
- data/lib/teacup/version.rb +1 -1
- data/lib/teacup/z_core_extensions/ui_view.rb +2 -2
- data/lib/teacup/z_core_extensions/z_handlers.rb +0 -20
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Teacup
|
2
|
+
module_function
|
3
|
+
def calculate(view, dimension, percent)
|
4
|
+
if percent.is_a? Proc
|
5
|
+
view.instance_exec(&percent)
|
6
|
+
elsif percent.is_a? String and percent[-1] == '%'
|
7
|
+
percent = percent[0...-1].to_f / 100.0
|
8
|
+
|
9
|
+
case dimension
|
10
|
+
when :width
|
11
|
+
CGRectGetWidth(view.superview.bounds) * percent
|
12
|
+
when :height
|
13
|
+
CGRectGetHeight(view.superview.bounds) * percent
|
14
|
+
end
|
15
|
+
else
|
16
|
+
percent
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/teacup/version.rb
CHANGED
@@ -87,7 +87,7 @@ class UIView
|
|
87
87
|
when Symbol, String
|
88
88
|
container = self
|
89
89
|
constraint.target = nil
|
90
|
-
while container
|
90
|
+
while container && constraint.target.nil?
|
91
91
|
constraint.target = container.viewWithStylename(original_constraint.target)
|
92
92
|
container = container.superview
|
93
93
|
end
|
@@ -105,7 +105,7 @@ class UIView
|
|
105
105
|
# superview, it checks all the leaves again.
|
106
106
|
container = self
|
107
107
|
constraint.relative_to = nil
|
108
|
-
while container
|
108
|
+
while container && constraint.relative_to.nil?
|
109
109
|
constraint.relative_to = container.viewWithStylename(original_constraint.relative_to)
|
110
110
|
container = container.superview
|
111
111
|
end
|
@@ -1,23 +1,3 @@
|
|
1
|
-
module Teacup
|
2
|
-
module_function
|
3
|
-
def calculate(view, dimension, percent)
|
4
|
-
if percent.is_a? Proc
|
5
|
-
view.instance_exec(&percent)
|
6
|
-
elsif percent.is_a? String and percent[-1] == '%'
|
7
|
-
percent = percent[0...-1].to_f / 100.0
|
8
|
-
|
9
|
-
case dimension
|
10
|
-
when :width
|
11
|
-
CGRectGetWidth(view.superview.bounds) * percent
|
12
|
-
when :height
|
13
|
-
CGRectGetHeight(view.superview.bounds) * percent
|
14
|
-
end
|
15
|
-
else
|
16
|
-
percent
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
1
|
##|
|
22
2
|
##| UIView.frame
|
23
3
|
##|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teacup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- app/views/custom_view.rb
|
75
75
|
- lib/dummy.rb
|
76
76
|
- lib/teacup.rb
|
77
|
+
- lib/teacup/calculations.rb
|
77
78
|
- lib/teacup/constraint.rb
|
78
79
|
- lib/teacup/handler.rb
|
79
80
|
- lib/teacup/layout.rb
|