Add support back for fixed x and y positioning of elements, fixed theming not using deep_merge

This commit is contained in:
2020-06-08 05:35:03 -05:00
parent a05ee57f6f
commit d0449c7b65
2 changed files with 7 additions and 4 deletions

View File

@@ -27,9 +27,6 @@ module CyberarmEngine
@width = 0 @width = 0
@height = 0 @height = 0
@fixed_x = @x if @x != 0
@fixed_y = @y if @y != 0
@style.width = default(:width) || nil @style.width = default(:width) || nil
@style.height = default(:height) || nil @style.height = default(:height) || nil
@@ -42,6 +39,7 @@ module CyberarmEngine
end end
def stylize def stylize
set_static_position
set_border_thickness(@style.border_thickness) set_border_thickness(@style.border_thickness)
set_padding(@style.padding) set_padding(@style.padding)
@@ -52,6 +50,11 @@ module CyberarmEngine
set_border_color(@style.border_color) set_border_color(@style.border_color)
end end
def set_static_position
@x = @style.x if @style.x != 0
@y = @style.y if @style.y != 0
end
def set_background(background) def set_background(background)
@style.background = background @style.background = background
@style.background_canvas.background = background @style.background_canvas.background = background

View File

@@ -12,7 +12,7 @@ module CyberarmEngine
def theme_defaults(options) def theme_defaults(options)
raise "Error" unless self.class.ancestors.include?(CyberarmEngine::Element) raise "Error" unless self.class.ancestors.include?(CyberarmEngine::Element)
_theme = THEME _theme = THEME
_theme = _theme.merge(options[:theme]) if options[:theme] _theme = deep_merge(_theme, options[:theme]) if options[:theme]
_theme.delete(:theme) if options[:theme] _theme.delete(:theme) if options[:theme]
hash = {} hash = {}