added Element#inner_width and Element#inner_height methods, EditLine now resets caret blink cycle when clicked

This commit is contained in:
2019-06-27 17:23:15 -05:00
parent bed78e7dc8
commit 8f3d9ff193
2 changed files with 13 additions and 2 deletions

View File

@@ -162,7 +162,7 @@ module CyberarmEngine
def width def width
if visible? if visible?
(@style.border_thickness_left + @style.padding_left) + @width + (@style.padding_right + @style.border_thickness_right) inner_width + @width
else else
0 0
end end
@@ -172,9 +172,13 @@ module CyberarmEngine
@style.margin_left + width + @style.margin_right @style.margin_left + width + @style.margin_right
end end
def inner_width
(@style.border_thickness_left + @style.padding_left) + (@style.padding_right + @style.border_thickness_right)
end
def height def height
if visible? if visible?
(@style.border_thickness_top + @style.padding_top) + @height + (@style.padding_bottom + @style.border_thickness_bottom) inner_height + @height
else else
0 0
end end
@@ -184,6 +188,10 @@ module CyberarmEngine
@style.margin_top + height + @style.margin_bottom @style.margin_top + height + @style.margin_bottom
end end
def inner_height
(@style.border_thickness_top + @style.padding_top) + (@style.padding_bottom + @style.border_thickness_bottom)
end
private def dimensional_size(size, dimension) private def dimensional_size(size, dimension)
raise "dimension must be either :width or :height" unless dimension == :width || dimension == :height raise "dimension must be either :width or :height" unless dimension == :width || dimension == :height
if size && size.is_a?(Numeric) if size && size.is_a?(Numeric)

View File

@@ -43,6 +43,9 @@ module CyberarmEngine
def left_mouse_button(sender, x, y) def left_mouse_button(sender, x, y)
super super
window.text_input = @text_input window.text_input = @text_input
@caret_last_interval = Gosu.milliseconds
@show_caret = true
end end
def enter(sender) def enter(sender)