Probably fixed Element dynamic width/height

This commit is contained in:
2019-10-24 10:47:13 -05:00
parent 7cc733dee4
commit 48d2924c9b

View File

@@ -168,6 +168,14 @@ module CyberarmEngine
end
end
def content_width
@width
end
def noncontent_width
(inner_width + outer_width) - width
end
def outer_width
@style.margin_left + width + @style.margin_right
end
@@ -184,6 +192,14 @@ module CyberarmEngine
end
end
def content_height
@height
end
def noncontent_height
(inner_height + outer_height) - height
end
def outer_height
@style.margin_top + height + @style.margin_bottom
end
@@ -196,7 +212,7 @@ module CyberarmEngine
raise "dimension must be either :width or :height" unless dimension == :width || dimension == :height
if size && size.is_a?(Numeric)
if size.between?(0.0, 1.0)
@parent.send(:"#{dimension}") * size
(@parent.send(:"content_#{dimension}") - self.send(:"noncontent_#{dimension}") - 1) * size
else
size
end