extends Node2D onready var n_DetachedViews := get_parent().find_node("DetachedViews") func _input(event): if not event is InputEventMouseButton: return var stack := [] for view in n_DetachedViews.get_children(): view.get_node("WindowDialog").hide() if view.get_node("WindowDialog").get_rect().has_point(event.position): stack.push_back(view) if stack.size() > 0: var front = stack.pop_back() for view in stack: view.get_node("WindowDialog").popup() front.get_node("WindowDialog").popup()