feat: collection context menu
This commit is contained in:
parent
7195ae9da5
commit
a47a818f8b
5 changed files with 38 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ class_name ContainerSelectionButton extends MarginContainer
|
|||
|
||||
@export var button: Button
|
||||
@export var container_box: ContainerBox
|
||||
@export var popup_menu: PopupMenu
|
||||
|
||||
var button_index: int
|
||||
|
||||
|
|
@ -19,3 +20,15 @@ func _enter_tree() -> void:
|
|||
## Buttons are 1-indexed, while [member UIManager.panel_array] is 0-index
|
||||
func _on_button_pressed() -> void:
|
||||
SignalBus.on_panel_requested.emit(button_index-1)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if get_global_rect().has_point(get_global_mouse_position()):
|
||||
if event.is_action_released("right_click"):
|
||||
popup_menu.popup_on_parent(
|
||||
Rect2(
|
||||
button.get_global_rect().position.x,
|
||||
button.get_global_rect().position.y+20,
|
||||
button.get_global_rect().size.x,
|
||||
button.get_global_rect().size.y)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue