mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Broke container layout some more
This commit is contained in:
@@ -11,9 +11,18 @@ module CyberarmEngine
|
||||
|
||||
def enter(sender)
|
||||
@background = @options[:interactive_hover_background]
|
||||
@text.color = @options[:interactive_stroke]
|
||||
end
|
||||
|
||||
def holding_left_mouse_button(sender, x, y)
|
||||
@background = @options[:interactive_active_background]
|
||||
@text.color = @options[:interactive_active_stroke]
|
||||
end
|
||||
|
||||
def released_left_mouse_button(sender,x, y)
|
||||
enter(sender)
|
||||
end
|
||||
|
||||
def leave(sender)
|
||||
@background = @options[:interactive_background]
|
||||
@text.color = @options[:interactive_stroke]
|
||||
|
||||
@@ -82,6 +82,9 @@ module CyberarmEngine
|
||||
@current_position = Vector.new(@margin_left + @x, @margin_top + @y)
|
||||
|
||||
layout
|
||||
|
||||
@width = @max_width ? @max_width : (@children.map {|c| c.x + c.width }.max + @margin_right || 0)
|
||||
@height = @max_height ? @max_height : (@children.map {|c| c.y + c.height}.max + @margin_bottom || 0)
|
||||
end
|
||||
|
||||
def layout
|
||||
@@ -101,7 +104,7 @@ module CyberarmEngine
|
||||
element.y = @current_position.y
|
||||
|
||||
@current_position.x += element.width + element.margin_right
|
||||
@current_position.x = @x if @current_position.x >= max_width
|
||||
@current_position.x = @margin_left + @x if @current_position.x >= max_width
|
||||
end
|
||||
|
||||
def move_to_next_line(element)
|
||||
|
||||
@@ -4,17 +4,16 @@ module CyberarmEngine
|
||||
|
||||
def layout
|
||||
@children.each do |child|
|
||||
child.recalculate
|
||||
|
||||
if fits_on_line?(child)
|
||||
position_on_current_line(child)
|
||||
else
|
||||
@current_position.x = @margin_left + @x
|
||||
|
||||
move_to_next_line(child)
|
||||
end
|
||||
|
||||
child.recalculate
|
||||
end
|
||||
|
||||
@width = @max_width ? @max_width : (@children.map {|c| c.x + c.width }.max || 0)
|
||||
@height = @max_height ? @max_height : (@children.map {|c| c.y + c.height}.max || 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -90,8 +90,10 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
def redirect_released_mouse_button(button)
|
||||
@mouse_over.publish(:"released_#{button}_mouse_button", window.mouse_x, window.mouse_y) if @mouse_over
|
||||
if @mouse_over
|
||||
@mouse_over.publish(:"released_#{button}_mouse_button", window.mouse_x, window.mouse_y)
|
||||
@mouse_over.publish(:"clicked_#{button}_mouse_button", window.mouse_x, window.mouse_y) if @mouse_over == @mouse_down_on[button]
|
||||
end
|
||||
|
||||
@mouse_down_position[button] = nil
|
||||
@mouse_down_on[button] = nil
|
||||
|
||||
@@ -27,8 +27,8 @@ module CyberarmEngine
|
||||
@width = @text.width
|
||||
@height= @text.height
|
||||
|
||||
@text.x = @x + @padding_left
|
||||
@text.y = @y + @padding_top
|
||||
@text.x = @padding_left + @x
|
||||
@text.y = @padding_top + @y
|
||||
@text.z = @z + 3
|
||||
end
|
||||
|
||||
|
||||
@@ -4,13 +4,10 @@ module CyberarmEngine
|
||||
|
||||
def layout
|
||||
@children.each do |child|
|
||||
move_to_next_line(child)
|
||||
|
||||
child.recalculate
|
||||
end
|
||||
|
||||
@width = @max_width ? @max_width : (@children.map {|c| c.x + c.width }.max || 0)
|
||||
@height = @max_height ? @max_height : (@children.map {|c| c.y + c.height}.max || 0)
|
||||
move_to_next_line(child)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -15,7 +15,7 @@ module CyberarmEngine
|
||||
background: Gosu::Color::NONE,
|
||||
checkmark: "√", # √
|
||||
|
||||
margin: 0,
|
||||
margin: 10,
|
||||
padding: 5,
|
||||
|
||||
element_background: Gosu::Color.rgb(12,12,12),
|
||||
|
||||
Reference in New Issue
Block a user