lib/teacup/stylesheet_extensions/constraints.rb in teacup-2.1.13 vs lib/teacup/stylesheet_extensions/constraints.rb in teacup-2.1.14
- old
+ new
@@ -48,12 +48,24 @@
def constrain_height(height)
Teacup::Constraint.new(:self, :height).equals(height)
end
def constrain_size(width, height)
+ if width.is_a? Numeric
+ width_attr = nil
+ else
+ width_attr = :width
+ end
+
+ if height.is_a? Numeric
+ height_attr = nil
+ else
+ height_attr = :height
+ end
+
[
- Teacup::Constraint.new(:self, :width).equals(width),
- Teacup::Constraint.new(:self, :height).equals(height),
+ Teacup::Constraint.new(:self, :width).equals(width, width_attr),
+ Teacup::Constraint.new(:self, :height).equals(height, height_attr),
]
end
##|
def constrain_below(relative_to, margin=0)