mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 21:22:33 +00:00
Probably fixed Element dynamic width/height
This commit is contained in:
@@ -168,6 +168,14 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def content_width
|
||||||
|
@width
|
||||||
|
end
|
||||||
|
|
||||||
|
def noncontent_width
|
||||||
|
(inner_width + outer_width) - width
|
||||||
|
end
|
||||||
|
|
||||||
def outer_width
|
def outer_width
|
||||||
@style.margin_left + width + @style.margin_right
|
@style.margin_left + width + @style.margin_right
|
||||||
end
|
end
|
||||||
@@ -184,6 +192,14 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def content_height
|
||||||
|
@height
|
||||||
|
end
|
||||||
|
|
||||||
|
def noncontent_height
|
||||||
|
(inner_height + outer_height) - height
|
||||||
|
end
|
||||||
|
|
||||||
def outer_height
|
def outer_height
|
||||||
@style.margin_top + height + @style.margin_bottom
|
@style.margin_top + height + @style.margin_bottom
|
||||||
end
|
end
|
||||||
@@ -196,7 +212,7 @@ module CyberarmEngine
|
|||||||
raise "dimension must be either :width or :height" unless dimension == :width || dimension == :height
|
raise "dimension must be either :width or :height" unless dimension == :width || dimension == :height
|
||||||
if size && size.is_a?(Numeric)
|
if size && size.is_a?(Numeric)
|
||||||
if size.between?(0.0, 1.0)
|
if size.between?(0.0, 1.0)
|
||||||
@parent.send(:"#{dimension}") * size
|
(@parent.send(:"content_#{dimension}") - self.send(:"noncontent_#{dimension}") - 1) * size
|
||||||
else
|
else
|
||||||
size
|
size
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user