mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 21:35:14 -04:00
Fix TabbedPager stealing arrow keys from TextFields (#6809)
This commit is contained in:
parent
05f656b6c1
commit
03579a884d
@ -453,12 +453,12 @@ open class TabbedPager(
|
|||||||
* Caller is responsible for cleanup if necessary. */
|
* Caller is responsible for cleanup if necessary. */
|
||||||
fun bindArrowKeys() {
|
fun bindArrowKeys() {
|
||||||
if (keyPressDispatcher == null) return
|
if (keyPressDispatcher == null) return
|
||||||
fun cyclePage(direction: Int) {
|
fun cyclePageFactory(direction: Int): ()->Unit = {
|
||||||
if (activePage == -1) return
|
if (activePage != -1 && (stage.keyboardFocus == null || hasKeyboardFocus()))
|
||||||
selectPage((activePage + direction).coerceIn(0 until pages.size))
|
selectPage((activePage + direction).coerceIn(pages.indices))
|
||||||
}
|
}
|
||||||
keyPressDispatcher[KeyCharAndCode(Input.Keys.LEFT)] = { cyclePage(-1) }
|
keyPressDispatcher[KeyCharAndCode(Input.Keys.LEFT)] = cyclePageFactory(-1)
|
||||||
keyPressDispatcher[KeyCharAndCode(Input.Keys.RIGHT)] = { cyclePage(1) }
|
keyPressDispatcher[KeyCharAndCode(Input.Keys.RIGHT)] = cyclePageFactory(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove a page by its index.
|
/** Remove a page by its index.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user