From 74d1ddd16b47576788981966f7f8fed40cc58d79 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Mon, 17 Jun 2019 08:56:17 -0500 Subject: [PATCH] Fixed not handling padding properly, fixed edit_line stuck appearing like mouse is hovering over it after mouse has left it --- lib/cyberarm_engine/ui/container.rb | 6 +++--- lib/cyberarm_engine/ui/edit_line.rb | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cyberarm_engine/ui/container.rb b/lib/cyberarm_engine/ui/container.rb index 5a44d95..73b5dd2 100644 --- a/lib/cyberarm_engine/ui/container.rb +++ b/lib/cyberarm_engine/ui/container.rb @@ -64,7 +64,7 @@ module CyberarmEngine end def recalculate - @current_position = Vector.new(@margin_left, @margin_top) + @current_position = Vector.new(@margin_left + @padding_left, @margin_top + @padding_top) unless @visible @width = 0 @height= 0 @@ -73,8 +73,8 @@ module CyberarmEngine layout - @width = @max_width ? @max_width : (@children.map {|c| c.x + c.width + c.margin_right }.max || 0).round - @height = @max_height ? @max_height : (@children.map {|c| c.y + c.height + c.margin_bottom}.max || 0).round + @width = @max_width ? @max_width : (@children.map {|c| c.x + c.outer_width }.max || 0).round + @height = @max_height ? @max_height : (@children.map {|c| c.y + c.outer_height}.max || 0).round # Move child to parent after positioning @children.each do |child| diff --git a/lib/cyberarm_engine/ui/edit_line.rb b/lib/cyberarm_engine/ui/edit_line.rb index 96648a7..228dd91 100644 --- a/lib/cyberarm_engine/ui/edit_line.rb +++ b/lib/cyberarm_engine/ui/edit_line.rb @@ -56,6 +56,9 @@ module CyberarmEngine end def leave(sender) + unless @focus + super + end end def blur(sender)