UI improvements

This commit is contained in:
2026-06-14 10:19:31 -05:00
parent 8ffde98fdd
commit 0cf1f92eaa
16 changed files with 263 additions and 114 deletions
+31
View File
@@ -0,0 +1,31 @@
class_name UIFocusStack extends RefCounted
signal activeLayerChanged(layer:ClosableMenu)
const Z_STEP:int = 10
var _stack:Array[ClosableMenu] = []
func push(layer:ClosableMenu) -> void:
if not _stack.is_empty():
_stack.back()._onFocusLost()
_stack.push_back(layer)
layer.z_index = _stack.size() * Z_STEP
layer._onFocusGained()
activeLayerChanged.emit(layer)
func pop() -> void:
if _stack.is_empty(): return
var removed:ClosableMenu = _stack.pop_back()
removed.z_index = 0
removed._onFocusLost()
var next:ClosableMenu = top()
if next != null:
next._onFocusGained()
activeLayerChanged.emit(next)
func top() -> ClosableMenu:
return _stack.back() if not _stack.is_empty() else null
func isTop(layer:ClosableMenu) -> bool:
return top() == layer