mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Fixed hidden elements were interactable, added comments
This commit is contained in:
@@ -18,6 +18,7 @@ module CyberarmEngine
|
|||||||
|
|
||||||
@label.subscribe(:clicked_left_mouse_button) do |sender, x, y|
|
@label.subscribe(:clicked_left_mouse_button) do |sender, x, y|
|
||||||
@toggle_button.clicked_left_mouse_button(sender, x, y)
|
@toggle_button.clicked_left_mouse_button(sender, x, y)
|
||||||
|
publish(:changed, @toggle_button.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@label.subscribe(:enter) do |sender|
|
@label.subscribe(:enter) do |sender|
|
||||||
@@ -42,7 +43,8 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def value=(bool)
|
def value=(bool)
|
||||||
@toggle_button.vlaue = bool
|
@toggle_button.value = bool
|
||||||
|
publish(:changed, @toggle_button.value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ module CyberarmEngine
|
|||||||
|
|
||||||
def hit_element?(x, y)
|
def hit_element?(x, y)
|
||||||
@children.reverse_each do |child|
|
@children.reverse_each do |child|
|
||||||
|
next unless child.visible?
|
||||||
|
|
||||||
case child
|
case child
|
||||||
when Container
|
when Container
|
||||||
if element = child.hit_element?(x, y)
|
if element = child.hit_element?(x, y)
|
||||||
@@ -108,10 +110,12 @@ module CyberarmEngine
|
|||||||
raise "Not overridden"
|
raise "Not overridden"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Fix @max_width no longer exists
|
||||||
def max_width
|
def max_width
|
||||||
@max_width ? @max_width : window.width - (@parent ? @parent.style.margin_right + @style.margin_right : @style.margin_right)
|
@max_width ? @max_width : window.width - (@parent ? @parent.style.margin_right + @style.margin_right : @style.margin_right)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Fix container automatic width (0.0..1.0) not considered
|
||||||
def fits_on_line?(element) # Flow
|
def fits_on_line?(element) # Flow
|
||||||
@current_position.x + element.outer_width <= max_width &&
|
@current_position.x + element.outer_width <= max_width &&
|
||||||
@current_position.x + element.outer_width <= window.width
|
@current_position.x + element.outer_width <= window.width
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module CyberarmEngine
|
|||||||
def clicked_left_mouse_button(sender, x, y)
|
def clicked_left_mouse_button(sender, x, y)
|
||||||
@block.call(self) if @block
|
@block.call(self) if @block
|
||||||
|
|
||||||
return :handled
|
# return :handled
|
||||||
end
|
end
|
||||||
|
|
||||||
def recalculate
|
def recalculate
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module CyberarmEngine
|
|||||||
@handle.recalculate
|
@handle.recalculate
|
||||||
@handle.update_background
|
@handle.update_background
|
||||||
|
|
||||||
pp @handle.height
|
# pp @handle.height
|
||||||
|
|
||||||
update_background
|
update_background
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user