Files
Dawn-Godot/ui/component/ModalBackdrop.gd
T
2026-06-14 10:19:31 -05:00

17 lines
475 B
GDScript

class_name ModalBackdrop extends ColorRect
func _ready() -> void:
visible = false
mouse_filter = MOUSE_FILTER_IGNORE
UI.FOCUS_STACK.activeLayerChanged.connect(_onActiveLayerChanged)
func _onActiveLayerChanged(layer:ClosableMenu) -> void:
if layer == null or layer.get_parent() != get_parent():
visible = false
mouse_filter = MOUSE_FILTER_IGNORE
z_index = 0
else:
visible = true
mouse_filter = MOUSE_FILTER_STOP
z_index = layer.z_index - 5