From ae43b04a25bb7054167e929e3cf0c94b9564c134 Mon Sep 17 00:00:00 2001 From: Nordup Date: Mon, 14 Aug 2023 01:33:01 +0400 Subject: [PATCH] prompt focus --- project/scenes/components/prompt.tscn | 20 ++++++++++---------- project/scenes/components/search.tscn | 2 -- project/scripts/ui/search/prompt.gd | 13 ++++++++++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/project/scenes/components/prompt.tscn b/project/scenes/components/prompt.tscn index 3defe50..21d50eb 100644 --- a/project/scenes/components/prompt.tscn +++ b/project/scenes/components/prompt.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://b57n6cvtqn5b7"] +[gd_scene load_steps=7 format=3 uid="uid://b57n6cvtqn5b7"] [ext_resource type="Script" path="res://scripts/ui/search/prompt.gd" id="1_7xv44"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_33m26"] @@ -13,17 +13,17 @@ corner_radius_bottom_left = 6 [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_srt8r"] bg_color = Color(0, 0, 0, 0.25098) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0, 0, 0, 0) +border_blend = true corner_radius_top_left = 6 corner_radius_top_right = 6 corner_radius_bottom_right = 6 corner_radius_bottom_left = 6 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_awixv"] -bg_color = Color(0, 0, 0, 0.25098) -corner_radius_top_left = 6 -corner_radius_top_right = 6 -corner_radius_bottom_right = 6 -corner_radius_bottom_left = 6 +shadow_color = Color(0, 0, 0, 0) [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6fg0o"] content_margin_left = 40.0 @@ -40,11 +40,11 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/normal = SubResource("StyleBoxFlat_wbjg7") theme_override_styles/hover = SubResource("StyleBoxFlat_srt8r") -theme_override_styles/pressed = SubResource("StyleBoxFlat_awixv") -theme_override_styles/focus = SubResource("StyleBoxFlat_srt8r") +theme_override_styles/pressed = SubResource("StyleBoxFlat_srt8r") script = ExtResource("1_7xv44") gate_events = ExtResource("2_33m26") prompt_text = NodePath("Label") +focus_style = SubResource("StyleBoxFlat_srt8r") [node name="Label" type="Label" parent="."] layout_mode = 1 diff --git a/project/scenes/components/search.tscn b/project/scenes/components/search.tscn index 127d004..ed0b9ba 100644 --- a/project/scenes/components/search.tscn +++ b/project/scenes/components/search.tscn @@ -35,8 +35,6 @@ corner_radius_bottom_left = 6 corner_detail = 10 [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mh73y"] -content_margin_left = 40.0 -content_margin_right = 40.0 bg_color = Color(0.207843, 0.164706, 0.47451, 1) border_width_left = 1 border_width_top = 1 diff --git a/project/scripts/ui/search/prompt.gd b/project/scripts/ui/search/prompt.gd index 64dc895..83f045b 100644 --- a/project/scripts/ui/search/prompt.gd +++ b/project/scripts/ui/search/prompt.gd @@ -1,8 +1,15 @@ -extends Control +extends Button class_name PromptResult @export var gate_events: GateEvents @export var prompt_text: Label +@export var focus_style: StyleBox + +var normal_style: StyleBox + + +func _ready() -> void: + normal_style = get_theme_stylebox("normal", "") func fill(prompt: Dictionary) -> void: @@ -19,8 +26,8 @@ func _on_button_pressed() -> void: func focus() -> void: - print("focus: " + prompt_text.text) + add_theme_stylebox_override("normal", focus_style) func unfocus() -> void: - print("unfocus: " + prompt_text.text) + add_theme_stylebox_override("normal", normal_style)