From d6f5fc5f8f713512c76fcd5c6ffcebdafc5139d5 Mon Sep 17 00:00:00 2001 From: Anish Mishra Date: Fri, 4 Jul 2025 18:17:44 +0530 Subject: [PATCH] Fix dropdown widget --- src/ui_widgets/dropdown.gd | 5 +++++ src/ui_widgets/dropdown.tscn | 2 +- src/ui_widgets/number_dropdown.tscn | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ui_widgets/dropdown.gd b/src/ui_widgets/dropdown.gd index cd0fae0..b303086 100644 --- a/src/ui_widgets/dropdown.gd +++ b/src/ui_widgets/dropdown.gd @@ -26,6 +26,7 @@ func set_value(new_value: Variant, emit_changed := true) -> void: func _ready() -> void: if not editing_enabled: line_edit.editable = false + line_edit.gui_input.connect(_on_line_edit_gui_input) line_edit.text_changed.connect(_on_text_changed) line_edit.text_submitted.connect(_on_text_submitted) _sync_line_edit() @@ -37,6 +38,10 @@ func _ready() -> void: max_width) line_edit.size.x = max_width + 4 +func _on_line_edit_gui_input(event: InputEvent): + if event is InputEventScreenTouch: + if event.pressed: _on_button_pressed() + func _on_button_pressed() -> void: var btn_arr: Array[Button] = [] for val in values: diff --git a/src/ui_widgets/dropdown.tscn b/src/ui_widgets/dropdown.tscn index 6c3e063..438ae1b 100644 --- a/src/ui_widgets/dropdown.tscn +++ b/src/ui_widgets/dropdown.tscn @@ -22,7 +22,7 @@ theme_override_fonts/font = ExtResource("2_s4ro5") script = ExtResource("1_0ifbb") [node name="Button" type="Button" parent="."] -custom_minimum_size = Vector2(15, 0) +custom_minimum_size = Vector2(20, 0) layout_mode = 2 size_flags_horizontal = 8 focus_mode = 0 diff --git a/src/ui_widgets/number_dropdown.tscn b/src/ui_widgets/number_dropdown.tscn index 2e7aacc..ecd0939 100644 --- a/src/ui_widgets/number_dropdown.tscn +++ b/src/ui_widgets/number_dropdown.tscn @@ -21,7 +21,7 @@ theme_override_fonts/font = ExtResource("2_v4n2i") script = ExtResource("3_y7lt6") [node name="Button" type="Button" parent="."] -custom_minimum_size = Vector2(15, 0) +custom_minimum_size = Vector2(20, 0) layout_mode = 2 focus_mode = 0 mouse_filter = 1