Fixed crashes when using EditBox with no content

This commit is contained in:
2020-12-08 20:27:01 -06:00
parent d02c001989
commit 246e0c54b2

View File

@@ -62,6 +62,7 @@ module CyberarmEngine
end end
def set_position(int) def set_position(int)
int = 0 if int < 0
@text_input.selection_start = @text_input.caret_pos = int @text_input.selection_start = @text_input.caret_pos = int
end end
@@ -166,7 +167,9 @@ module CyberarmEngine
end end
def drag_update(sender, x, y, button) def drag_update(sender, x, y, button)
@text_input.caret_pos = caret_position_under_mouse(x, y) int = caret_position_under_mouse(x, y)
int = 0 if int < 0
@text_input.caret_pos = int
:handled :handled
end end