Fixed hidden elements were interactable, added comments

This commit is contained in:
2020-05-05 10:48:00 -05:00
parent da5d740c6e
commit a98bb4ec82
4 changed files with 9 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ module CyberarmEngine
@label.subscribe(:clicked_left_mouse_button) do |sender, x, y|
@toggle_button.clicked_left_mouse_button(sender, x, y)
publish(:changed, @toggle_button.value)
end
@label.subscribe(:enter) do |sender|
@@ -42,7 +43,8 @@ module CyberarmEngine
end
def value=(bool)
@toggle_button.vlaue = bool
@toggle_button.value = bool
publish(:changed, @toggle_button.value)
end
end
end

View File

@@ -57,6 +57,8 @@ module CyberarmEngine
def hit_element?(x, y)
@children.reverse_each do |child|
next unless child.visible?
case child
when Container
if element = child.hit_element?(x, y)
@@ -108,10 +110,12 @@ module CyberarmEngine
raise "Not overridden"
end
# TODO: Fix @max_width no longer exists
def max_width
@max_width ? @max_width : window.width - (@parent ? @parent.style.margin_right + @style.margin_right : @style.margin_right)
end
# TODO: Fix container automatic width (0.0..1.0) not considered
def fits_on_line?(element) # Flow
@current_position.x + element.outer_width <= max_width &&
@current_position.x + element.outer_width <= window.width

View File

@@ -14,7 +14,7 @@ module CyberarmEngine
def clicked_left_mouse_button(sender, x, y)
@block.call(self) if @block
return :handled
# return :handled
end
def recalculate

View File

@@ -57,7 +57,7 @@ module CyberarmEngine
@handle.recalculate
@handle.update_background
pp @handle.height
# pp @handle.height
update_background
end