motion-kit 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/motion-kit/layouts/base_layout.rb +11 -10
- data/lib/motion-kit/layouts/tree_layout.rb +12 -4
- data/lib/motion-kit/version.rb +1 -1
- data/lib/motion-kit-ios/layouts/uiview_layout_constraints.rb +2 -2
- data/lib/motion-kit-osx/layouts/nsview_layout_constraints.rb +2 -2
- 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: 665a6faaa86cd43115e40abd585320a896a9fd96
|
4
|
+
data.tar.gz: 5fea5265cd53696a68b3fa55537bb67a4a037e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9e2d7f10c6c119022d9a34eec953ee8f8666f9ef5f9d9433508657b0507f567d94c2a238eb4fac0cb7168c54d2a3a75168357f110349a1edc4316c7eeaaa5ba
|
7
|
+
data.tar.gz: 664fe1f270a84b5078ec61b85535a12eccae172399a4b5534660ab32fb88bd3d7b3cee2ea6f921ce01b4d5605129ffbcfc8d531811e535ab8bc8bc5b82184991
|
@@ -31,7 +31,7 @@ module MotionKit
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def set_layout(layout)
|
34
|
-
@layout =
|
34
|
+
@layout = WeakRef.new(layout)
|
35
35
|
end
|
36
36
|
|
37
37
|
def target
|
@@ -106,20 +106,21 @@ module MotionKit
|
|
106
106
|
|
107
107
|
# Blocks passed to `deferred` are run at the end of a "session", usually
|
108
108
|
# after a call to Layout#layout.
|
109
|
-
def deferred(&block)
|
110
|
-
|
111
|
-
|
112
|
-
else
|
113
|
-
return self.add_deferred_block(self, &block)
|
114
|
-
end
|
109
|
+
def deferred(context=nil, &block)
|
110
|
+
context ||= @context
|
111
|
+
return @layout.add_deferred_block(context, &block)
|
115
112
|
end
|
116
113
|
|
117
114
|
# Only intended for private use
|
118
|
-
def add_deferred_block(
|
119
|
-
|
115
|
+
def add_deferred_block(context, &block)
|
116
|
+
context ||= @context
|
117
|
+
if context.nil? && @assign_root
|
118
|
+
context ||= self.create_default_root_context
|
119
|
+
end
|
120
|
+
raise InvalidDeferredError.new('deferred must be run inside of a context') unless context
|
120
121
|
raise ArgumentError.new('Block required') unless block
|
121
122
|
|
122
|
-
self.deferred_blocks << [
|
123
|
+
self.deferred_blocks << [context, block]
|
123
124
|
|
124
125
|
self
|
125
126
|
end
|
@@ -90,7 +90,7 @@ module MotionKit
|
|
90
90
|
element_id = element
|
91
91
|
# See note below about why we don't need to `apply(:default_root)`
|
92
92
|
element = preset_root || default_root
|
93
|
-
elsif
|
93
|
+
elsif preset_root && preset_root != element
|
94
94
|
# You're trying to make two roots, one at initialization
|
95
95
|
# and one in your layout itself.
|
96
96
|
raise ContextConflictError.new("Already created the root view")
|
@@ -154,20 +154,28 @@ module MotionKit
|
|
154
154
|
return self
|
155
155
|
end
|
156
156
|
|
157
|
+
def reapply?
|
158
|
+
@layout_state == :reapply
|
159
|
+
end
|
160
|
+
|
157
161
|
# Calls the style method of all objects in the view hierarchy
|
158
162
|
def reapply(&block)
|
159
163
|
raise ArgumentError.new('Block required') unless block
|
160
164
|
|
161
|
-
if
|
165
|
+
if reapply?
|
162
166
|
yield
|
163
167
|
end
|
164
168
|
return self
|
165
169
|
end
|
166
170
|
|
171
|
+
def initial?
|
172
|
+
@layout_state == :initial
|
173
|
+
end
|
174
|
+
|
167
175
|
def initial(&block)
|
168
176
|
raise ArgumentError.new('Block required') unless block
|
169
177
|
|
170
|
-
if
|
178
|
+
if initial?
|
171
179
|
yield
|
172
180
|
end
|
173
181
|
return self
|
@@ -335,7 +343,7 @@ module MotionKit
|
|
335
343
|
# `ViewLayout`, which returns the root view.
|
336
344
|
def initialize_element(elem)
|
337
345
|
if elem.is_a?(Class) && elem < TreeLayout
|
338
|
-
elem = elem.new_child(@layout
|
346
|
+
elem = elem.new_child(@layout).view
|
339
347
|
elsif elem.is_a?(Class)
|
340
348
|
elem = elem.new
|
341
349
|
elsif elem.is_a?(TreeLayout)
|
data/lib/motion-kit/version.rb
CHANGED
@@ -9,8 +9,8 @@ module MotionKit
|
|
9
9
|
end
|
10
10
|
view.setTranslatesAutoresizingMaskIntoConstraints(false)
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
constraints_target = ConstraintsTarget.new(view)
|
13
|
+
deferred(constraints_target) do
|
14
14
|
context(constraints_target, &block)
|
15
15
|
constraints_target.apply_all_constraints(self, view)
|
16
16
|
end
|
@@ -9,8 +9,8 @@ module MotionKit
|
|
9
9
|
end
|
10
10
|
view.setTranslatesAutoresizingMaskIntoConstraints(false)
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
constraints_target = ConstraintsTarget.new(view)
|
13
|
+
deferred(constraints_target) do
|
14
14
|
context(constraints_target, &block)
|
15
15
|
constraints_target.apply_all_constraints(self, view)
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dbt
|