implemented textCommitListener for UIItemTextLineInput

This commit is contained in:
minjaesong
2022-08-03 00:54:52 +09:00
parent 026a90c0aa
commit 75659dee6e
2 changed files with 21 additions and 2 deletions

View File

@@ -149,6 +149,9 @@ class UIItemTextLineInput(
private val candidatesBackCol = TEXTINPUT_COL_BACKGROUND.cpy().mul(1f,1f,1f,1.5f)
private val candidateNumberStrWidth = App.fontGame.getWidth("8. ")
/** Event fired whenever a character is entered or pasted from clipboard */
var textCommitListener: (String) -> Unit = {}
private fun getIME(ignoreOnOff: Boolean = false): TerrarumIME? {
if (!imeOn && !ignoreOnOff) return null
@@ -481,6 +484,7 @@ class UIItemTextLineInput(
it.color = Color.WHITE
App.fontGameFBO.draw(it, if (textbuf.isEmpty()) currentPlaceholderText else textbuf, -1f*cursorDrawScroll, 0f)
} }
textCommitListener(getTextOrPlaceholder())
}
batch.begin()