mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
fix: textbuttonlist selector appearance bug, nsmenu not closing its child
This commit is contained in:
@@ -169,8 +169,8 @@ class UIItemTextButtonList(
|
|||||||
val oldIndex = selectedIndex
|
val oldIndex = selectedIndex
|
||||||
|
|
||||||
if (kinematic) {
|
if (kinematic) {
|
||||||
highlighterYStart = buttons[selectedIndex!!].posY.toDouble()
|
|
||||||
selectedIndex = index
|
selectedIndex = index
|
||||||
|
highlighterYStart = buttons[selectedIndex!!].posY.toDouble()
|
||||||
highlighterMoving = true
|
highlighterMoving = true
|
||||||
highlighterYEnd = buttons[selectedIndex!!].posY.toDouble()
|
highlighterYEnd = buttons[selectedIndex!!].posY.toDouble()
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ class UIItemTextButtonList(
|
|||||||
batch.color = highlightBackCol
|
batch.color = highlightBackCol
|
||||||
BlendMode.resolve(highlightBackBlendMode, batch)
|
BlendMode.resolve(highlightBackBlendMode, batch)
|
||||||
if (highlightY != null) {
|
if (highlightY != null) {
|
||||||
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
|
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), itemHitboxSize.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.forEach { it.render(batch, camera) }
|
buttons.forEach { it.render(batch, camera) }
|
||||||
|
|||||||
@@ -78,16 +78,20 @@ class UINSMenu(
|
|||||||
// List selection change listener
|
// List selection change listener
|
||||||
list.selectionChangeListener = { old, new ->
|
list.selectionChangeListener = { old, new ->
|
||||||
// if the selection has a child...
|
// if the selection has a child...
|
||||||
|
|
||||||
|
//println("new sel: ${tree.children[new]}")
|
||||||
|
|
||||||
|
|
||||||
|
// 1. pop as far as possible
|
||||||
|
// 2. push the new menu
|
||||||
|
|
||||||
|
// 1. pop as far as possible
|
||||||
|
while (listStack.peek().list != list) {
|
||||||
|
popSubMenu()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. push the new menu
|
||||||
if (tree.children[new].children.isNotEmpty()) {
|
if (tree.children[new].children.isNotEmpty()) {
|
||||||
// 1. pop as far as possible
|
|
||||||
// 2. push the new menu
|
|
||||||
|
|
||||||
// 1. pop as far as possible
|
|
||||||
while (listStack.peek().list != list) {
|
|
||||||
popSubMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. push the new menu
|
|
||||||
addSubMenu(tree.children[new])
|
addSubMenu(tree.children[new])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user