From abe99ce9490881b82b8037c5287117010d20ac46 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 17 Sep 2026 12:25:48 -0500 Subject: [PATCH] Ignore sibling elements that aren't visible from fill mode space considerations --- lib/cyberarm_engine/ui/element.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cyberarm_engine/ui/element.rb b/lib/cyberarm_engine/ui/element.rb index fc9664a..32971b2 100644 --- a/lib/cyberarm_engine/ui/element.rb +++ b/lib/cyberarm_engine/ui/element.rb @@ -518,7 +518,7 @@ module CyberarmEngine def space_available_height # TODO: This may get expensive if there are a lot of children, probably should cache it somehow - fill_siblings = @parent.children.select { |c| c.styled(:fill) }.count.to_f # include self since we're dividing + fill_siblings = @parent.children.select { |c| c.styled(:fill) && c.visible? }.count.to_f # include self since we're dividing available_space = ((@parent.content_height - (@parent.children.reject { |c| c.styled(:fill) }).map(&:outer_height).sum) / fill_siblings) (available_space.nan? || available_space.infinite?) ? 0 : available_space.floor # The parent element might not have its dimensions, yet.