diff --git a/inventory/inventory_overlay/InventoryOverlay.gd b/inventory/inventory_overlay/InventoryOverlay.gd index 77123e4..72d6450 100644 --- a/inventory/inventory_overlay/InventoryOverlay.gd +++ b/inventory/inventory_overlay/InventoryOverlay.gd @@ -182,11 +182,17 @@ func _update_hover_label() -> void: hover_label.text = "" func _on_background_gui_input(event: InputEvent) -> void: - print("[OVERLAY] background clicked") if event is InputEventMouseButton and event.button_index == 1 and event.pressed: hide_overlay() close_requested.emit() +func _gui_input(event: InputEvent) -> void: + if event is InputEventMouseButton and event.button_index == 1 and event.pressed: + var panel_rect = panel.get_global_rect() + if not panel_rect.has_point(get_global_mouse_position()): + hide_overlay() + close_requested.emit() + func _gui_input(event: InputEvent) -> void: print("HI") if not _is_visible: diff --git a/inventory/inventory_overlay/InventoryOverlay.tscn b/inventory/inventory_overlay/InventoryOverlay.tscn index 80a939c..41ce567 100644 --- a/inventory/inventory_overlay/InventoryOverlay.tscn +++ b/inventory/inventory_overlay/InventoryOverlay.tscn @@ -23,7 +23,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -mouse_filter = 0 +mouse_filter = 1 color = Color(0, 0, 0, 0.7) [node name="InventoryPanel" type="Control" parent="." unique_id=-1294967293]