more focus fixes
This commit is contained in:
parent
dd74643c67
commit
fc0bc69488
@ -300,17 +300,12 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
*
|
*
|
||||||
* @param panel panel to be pushed up
|
* @param panel panel to be pushed up
|
||||||
*/
|
*/
|
||||||
fun popup(panel: EditablePanel<MatteryScreen<*>>) {
|
fun popup(panel: EditablePanel<MatteryScreen<*>>): Boolean {
|
||||||
val indexOf = panels.indexOf(panel)
|
val indexOf = panels.indexOf(panel)
|
||||||
|
if (indexOf <= 0) return false
|
||||||
require(indexOf != -1) { "No such panel $panel" }
|
|
||||||
|
|
||||||
if (indexOf == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
panels.removeAt(indexOf)
|
panels.removeAt(indexOf)
|
||||||
panels.addFirst(panel)
|
panels.addFirst(panel)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1185,6 +1185,10 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
var parent: EditablePanel<*>? = this
|
var parent: EditablePanel<*>? = this
|
||||||
|
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
|
if (parent.parent == null) {
|
||||||
|
parent.popup(false)
|
||||||
|
}
|
||||||
|
|
||||||
for (child in parent.childrenInternal) {
|
for (child in parent.childrenInternal) {
|
||||||
if (child !== filter) {
|
if (child !== filter) {
|
||||||
child.killFocus()
|
child.killFocus()
|
||||||
@ -1193,8 +1197,11 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
|
|
||||||
filter = parent
|
filter = parent
|
||||||
parent = parent.parent
|
parent = parent.parent
|
||||||
parent?.killFocusThis(false)
|
|
||||||
parent?.hasFocusedChildren = true
|
if (parent != null) {
|
||||||
|
parent.killFocusThis(false)
|
||||||
|
parent.hasFocusedChildren = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isFocusedThis = true
|
isFocusedThis = true
|
||||||
@ -1328,12 +1335,8 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseClickedInner(x, y, button)) {
|
if (autoRequestFocus) requestFocus()
|
||||||
if (autoRequestFocus) requestFocus()
|
return mouseClickedInner(x, y, button)
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mouseClickedChecked(x: Double, y: Double, button: Int): Boolean {
|
fun mouseClickedChecked(x: Double, y: Double, button: Int): Boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user