diff --git a/project.godot b/project.godot index fefb9a8..aca5d05 100644 --- a/project.godot +++ b/project.godot @@ -32,6 +32,14 @@ window/size/transparent=true window/subwindows/embed_subwindows=false window/per_pixel_transparency/allowed=true +[input] + +right_click={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(94, 14),"global_position":Vector2(103, 60),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + [rendering] renderer/rendering_method="gl_compatibility" diff --git a/src/UI/buttons/container_selection_button.gd b/src/UI/buttons/container_selection_button.gd index c1a5a2d..345b5af 100644 --- a/src/UI/buttons/container_selection_button.gd +++ b/src/UI/buttons/container_selection_button.gd @@ -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) + ) diff --git a/src/UI/buttons/container_selection_button.tscn b/src/UI/buttons/container_selection_button.tscn index fd5503f..c65de86 100644 --- a/src/UI/buttons/container_selection_button.tscn +++ b/src/UI/buttons/container_selection_button.tscn @@ -1,7 +1,9 @@ -[gd_scene load_steps=6 format=3 uid="uid://csre4kogd8afg"] +[gd_scene load_steps=8 format=3 uid="uid://csre4kogd8afg"] [ext_resource type="Script" uid="uid://osei0aimuya2" path="res://src/UI/buttons/container_selection_button.gd" id="1_g121j"] [ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_ru1ls"] +[ext_resource type="Texture2D" uid="uid://ne4o3drvj5vw" path="res://src/assets/icons/color-picker.svg" id="3_wvlx0"] +[ext_resource type="Texture2D" uid="uid://s3vf3vhl8y3e" path="res://src/assets/icons/trash.svg" id="4_4ff2x"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_dv4hw"] @@ -10,7 +12,7 @@ [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gtrax"] bg_color = Color(0.43134, 0.43134, 0.43134, 1) -[node name="ContainerSelectionButton" type="MarginContainer" node_paths=PackedStringArray("button")] +[node name="ContainerSelectionButton" type="MarginContainer" node_paths=PackedStringArray("button", "popup_menu")] offset_right = 40.0 offset_bottom = 40.0 scale = Vector2(1, 1.02369) @@ -20,6 +22,7 @@ theme_override_constants/margin_right = 5 theme_override_constants/margin_bottom = 5 script = ExtResource("1_g121j") button = NodePath("Button") +popup_menu = NodePath("PopupMenu") [node name="Button" type="Button" parent="."] layout_mode = 2 @@ -30,4 +33,13 @@ theme_override_styles/hover = SubResource("StyleBoxFlat_05tj4") theme_override_styles/pressed = SubResource("StyleBoxFlat_gtrax") text = "Collection 1" +[node name="PopupMenu" type="PopupMenu" parent="."] +item_count = 2 +item_0/text = "Edit Name" +item_0/icon = ExtResource("3_wvlx0") +item_0/id = 0 +item_1/text = "Delete" +item_1/icon = ExtResource("4_4ff2x") +item_1/id = 1 + [connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/src/UI/done_box.gd b/src/UI/done_box.gd index 37a35e7..ff1764b 100644 --- a/src/UI/done_box.gd +++ b/src/UI/done_box.gd @@ -22,7 +22,8 @@ func _process(delta: float) -> void: pass func _on_index_pressed(index:int) -> void: - print(index) + if instantiated_menu != null: + return if index == 0: instantiated_menu = edit_menu.instantiate() add_child(instantiated_menu) diff --git a/src/UI/main_panel.tscn b/src/UI/main_panel.tscn index 2b23601..ba451f9 100644 --- a/src/UI/main_panel.tscn +++ b/src/UI/main_panel.tscn @@ -75,7 +75,7 @@ theme_override_constants/separation = 10 layout_mode = 2 size_flags_horizontal = 3 bbcode_enabled = true -text = "[b]MM.DD.YYYY[b]" +text = "[b]DD.MM.YYYY[b]" fit_content = true horizontal_alignment = 1 vertical_alignment = 1