mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-15 20:52:35 +00:00
Use shorthand (&:method) for Element scroll_width/height max_scroll_width, possibly fix dimentional_size returning the wrong size when element has nonzero padding/margin/border_thickness
This commit is contained in:
@@ -352,11 +352,11 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def scroll_width
|
def scroll_width
|
||||||
@children.sum { |c| c.width } + noncontent_width
|
@children.sum(&:width) + noncontent_width
|
||||||
end
|
end
|
||||||
|
|
||||||
def scroll_height
|
def scroll_height
|
||||||
@children.sum { |c| c.height } + noncontent_height
|
@children.sum(&:height) + noncontent_height
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_scroll_width
|
def max_scroll_width
|
||||||
@@ -370,12 +370,10 @@ module CyberarmEngine
|
|||||||
def dimensional_size(size, dimension)
|
def dimensional_size(size, dimension)
|
||||||
raise "dimension must be either :width or :height" unless %i[width height].include?(dimension)
|
raise "dimension must be either :width or :height" unless %i[width height].include?(dimension)
|
||||||
|
|
||||||
if size && size.is_a?(Numeric)
|
if size.is_a?(Numeric) && size.between?(0.0, 1.0)
|
||||||
if size.between?(0.0, 1.0)
|
(@parent.send(:"content_#{dimension}") * size).round - send(:"noncontent_#{dimension}").round
|
||||||
((@parent.send(:"content_#{dimension}") - send(:"noncontent_#{dimension}")) * size).round
|
else
|
||||||
else
|
size
|
||||||
size
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user