fix: 'q' would close the ui when you're typing in something

This commit is contained in:
minjaesong
2023-09-05 00:41:43 +09:00
parent d0e1555ad0
commit cf98c13111
7 changed files with 54 additions and 11 deletions

View File

@@ -415,13 +415,25 @@ class UIItemTextLineInput(
fboUpdateLatch = true
}
override fun hide() {
super.hide()
if (this.isEnabled) {
this.isEnabled = false
TerrarumGlobalState.HAS_KEYBOARD_INPUT_FOCUS.unset()
}
}
override fun update(delta: Float) {
if (mouseoverUpdateLatch) {
super.update(delta)
val mouseDown = Terrarum.mouseDown
if (mouseDown) {
val oldEnabled = isEnabled
isEnabled = mouseUp
if (oldEnabled && !isEnabled) TerrarumGlobalState.HAS_KEYBOARD_INPUT_FOCUS.unset()
if (!oldEnabled && isEnabled) TerrarumGlobalState.HAS_KEYBOARD_INPUT_FOCUS.set()
}
if (App.getConfigString("inputmethod") == "none") imeOn = false