lib/cyberarm_engine/ui/element.rb in cyberarm_engine-0.8.0 vs lib/cyberarm_engine/ui/element.rb in cyberarm_engine-0.8.1
- old
+ new
@@ -6,11 +6,11 @@
attr_accessor :x, :y, :z, :enabled
attr_reader :parent, :options, :style, :event_handler, :background_canvas, :border_canvas
def initialize(options = {}, block = nil)
- @parent = options[:parent] # parent Container (i.e. flow/stack)
+ @parent = options.delete(:parent) # parent Container (i.e. flow/stack)
options = theme_defaults(options)
@options = options
@block = block
@focus = false
@@ -24,18 +24,18 @@
@z = @style.z
@fixed_x = @x if @x != 0
@fixed_y = @y if @y != 0
+ @style.width = default(:width) || $window.width
+ @style.height = default(:height) || $window.height
+
stylize
default_events
end
def stylize
- @style.width = @style.width || $window.width
- @style.height = @style.height || $window.height
-
set_border_thickness(@style.border_thickness)
set_padding(@style.padding)
set_margin(@style.margin)
\ No newline at end of file