Root Container width/height now always match window

This commit is contained in:
2019-06-23 11:27:13 -05:00
parent e95b4c05e2
commit 72df060059
2 changed files with 11 additions and 2 deletions

View File

@@ -60,8 +60,13 @@ module CyberarmEngine
layout layout
@style.width = @max_width ? @max_width : (@children.map {|c| c.x + c.outer_width }.max || 0).round if is_root?
@style.height = @max_height ? @max_height : (@children.map {|c| c.y + c.outer_height}.max || 0).round @style.width = window.width
@style.height = window.height
else
@style.width = @max_width ? @max_width : (@children.map {|c| c.x + c.outer_width }.max || 0).round
@style.height = @max_height ? @max_height : (@children.map {|c| c.y + c.outer_height}.max || 0).round
end
# Move child to parent after positioning # Move child to parent after positioning
@children.each do |child| @children.each do |child|

View File

@@ -214,6 +214,10 @@ module CyberarmEngine
@root @root
end end
def is_root?
@gui_state != nil
end
def recalculate def recalculate
raise "#{self.class}#recalculate was not overridden!" raise "#{self.class}#recalculate was not overridden!"
end end