fix 'Input widget will raise error when candidate_text field is not defined'

This commit is contained in:
endlesstravel 2017-10-31 19:38:14 +08:00
parent 6b302f777c
commit 12610bfe8f
4 changed files with 12 additions and 3 deletions

View file

@ -13,6 +13,7 @@ function suit.new(theme)
theme = theme or default_theme,
mouse_x = 0, mouse_y = 0,
mouse_button_down = false,
candidate_text = {text="", start=0, length=0},
draw_queue = {n = 0},
@ -146,6 +147,12 @@ function suit:textinput(char)
self.textchar = char
end
function suit:textedited(text, start, length)
self.candidate_text.text = text
self.candidate_text.start = start
self.candidate_text.length = length
end
function suit:grabKeyboardFocus(id)
if self:isActive(id) then
if love.system.getOS() == "Android" or love.system.getOS() == "iOS" then