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
|
||||
|
||||
def scroll_width
|
||||
@children.sum { |c| c.width } + noncontent_width
|
||||
@children.sum(&:width) + noncontent_width
|
||||
end
|
||||
|
||||
def scroll_height
|
||||
@children.sum { |c| c.height } + noncontent_height
|
||||
@children.sum(&:height) + noncontent_height
|
||||
end
|
||||
|
||||
def max_scroll_width
|
||||
@@ -370,14 +370,12 @@ module CyberarmEngine
|
||||
def dimensional_size(size, dimension)
|
||||
raise "dimension must be either :width or :height" unless %i[width height].include?(dimension)
|
||||
|
||||
if size && size.is_a?(Numeric)
|
||||
if size.between?(0.0, 1.0)
|
||||
((@parent.send(:"content_#{dimension}") - send(:"noncontent_#{dimension}")) * size).round
|
||||
if size.is_a?(Numeric) && size.between?(0.0, 1.0)
|
||||
(@parent.send(:"content_#{dimension}") * size).round - send(:"noncontent_#{dimension}").round
|
||||
else
|
||||
size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def background=(_background)
|
||||
@style.background_canvas.background = _background
|
||||
|
||||
Reference in New Issue
Block a user