mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 21:22:33 +00:00
Compare commits
2 Commits
97296b080c
...
705138f7ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 705138f7ad | |||
| 94a65f447c |
@@ -182,7 +182,7 @@ module CyberarmEngine
|
||||
element.y = element.style.margin_top + @current_position.y
|
||||
|
||||
@current_position.x += element.outer_width
|
||||
@current_position.x = @style.margin_left if @current_position.x >= max_width
|
||||
@current_position.x = @style.margin_left + @style.padding_left if @current_position.x >= max_width
|
||||
end
|
||||
|
||||
def tallest_neighbor(querier, _y_position) # Flow
|
||||
@@ -195,14 +195,14 @@ module CyberarmEngine
|
||||
response
|
||||
end
|
||||
|
||||
def position_on_next_line(child) # Flow
|
||||
@current_position.x = @style.margin_left
|
||||
@current_position.y += tallest_neighbor(child, @current_position.y).outer_height
|
||||
def position_on_next_line(element) # Flow
|
||||
@current_position.x = @style.margin_left + @style.padding_left
|
||||
@current_position.y += tallest_neighbor(element, @current_position.y).outer_height
|
||||
|
||||
child.x = child.style.margin_left + @current_position.x
|
||||
child.y = child.style.margin_top + @current_position.y
|
||||
element.x = element.style.margin_left + @current_position.x
|
||||
element.y = element.style.margin_top + @current_position.y
|
||||
|
||||
@current_position.x += child.outer_width
|
||||
@current_position.x += element.outer_width
|
||||
end
|
||||
|
||||
def move_to_next_line(element) # Stack
|
||||
|
||||
@@ -13,7 +13,7 @@ module CyberarmEngine
|
||||
@style.background_canvas.background = default(:background)
|
||||
|
||||
# TODO: "Clean Up" into own class?
|
||||
@menu = Stack.new(parent: parent, width: @options[:width], theme: @options[:theme])
|
||||
@menu = Stack.new(parent: self, theme: @options[:theme])
|
||||
@menu.define_singleton_method(:recalculate_menu) do
|
||||
@x = @__list_box.x
|
||||
@y = @__list_box.y + @__list_box.height
|
||||
@@ -64,6 +64,8 @@ module CyberarmEngine
|
||||
def show_menu
|
||||
@menu.clear
|
||||
|
||||
@menu.style.width = width
|
||||
|
||||
@items.each do |item|
|
||||
next if item == self.value
|
||||
|
||||
|
||||
@@ -171,6 +171,9 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
@focus.button_up(id) if @focus.respond_to?(:button_up)
|
||||
|
||||
# Prevents menu from popping back up if the listbox is clicked to hide it.
|
||||
@hid_menu_for = nil
|
||||
end
|
||||
|
||||
def tool_tip_delay
|
||||
@@ -185,7 +188,7 @@ module CyberarmEngine
|
||||
@focus = nil
|
||||
end
|
||||
|
||||
if @mouse_over
|
||||
if @mouse_over && @hid_menu_for != @mouse_over
|
||||
@mouse_down_position[button] = Vector.new(window.mouse_x, window.mouse_y)
|
||||
@mouse_down_on[button] = @mouse_over
|
||||
|
||||
@@ -199,7 +202,7 @@ module CyberarmEngine
|
||||
def redirect_released_mouse_button(button)
|
||||
hide_menu if @menu && (@menu == @mouse_over) || (@mouse_over&.parent == @menu)
|
||||
|
||||
if @mouse_over
|
||||
if @mouse_over && @hid_menu_for != @mouse_over
|
||||
@mouse_over.publish(:"released_#{button}_mouse_button", window.mouse_x, window.mouse_y)
|
||||
if @mouse_over == @mouse_down_on[button]
|
||||
@mouse_over.publish(:"clicked_#{button}_mouse_button", window.mouse_x,
|
||||
@@ -255,6 +258,9 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
def hide_menu
|
||||
return unless @menu
|
||||
|
||||
@hid_menu_for = @menu.parent
|
||||
@menu = nil
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user