Method: CyberarmEngine::Element#space_available_width
- Defined in:
- lib/cyberarm_engine/ui/element.rb
#space_available_width ⇒ Object
494 495 496 497 498 499 500 |
# File 'lib/cyberarm_engine/ui/element.rb', line 494 def space_available_width # TODO: This may get expensive if there are a lot of children, probably should cache it somehow fill_siblings = @parent.children.select { |c| c.style.fill }.count.to_f # include self since we're dividing available_space = ((@parent.content_width - (@parent.children.reject { |c| c.style.fill }).map(&:outer_width).sum) / fill_siblings) (available_space.nan? || available_space.infinite?) ? 0 : available_space.floor # The parent element might not have its dimensions, yet. end |