mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-18 12:16:33 -04:00
help button, scroll with prompt
This commit is contained in:
parent
00fa349440
commit
647b0ca20c
6 changed files with 142 additions and 15 deletions
|
@ -340,7 +340,7 @@ script = ExtResource("14_h86vl")
|
|||
search = NodePath("..")
|
||||
prompt_results = NodePath("Panel/VBoxContainer")
|
||||
|
||||
[node name="Panel" type="Panel" parent="Prompt" node_paths=PackedStringArray("search_le")]
|
||||
[node name="Panel" type="Panel" parent="Prompt" node_paths=PackedStringArray("search")]
|
||||
visible = false
|
||||
top_level = true
|
||||
layout_mode = 1
|
||||
|
@ -354,7 +354,7 @@ offset_bottom = 860.0
|
|||
grow_horizontal = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_mh73y")
|
||||
script = ExtResource("15_35wcy")
|
||||
search_le = NodePath("../..")
|
||||
search = NodePath("../..")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Prompt/Panel" node_paths=PackedStringArray("panel")]
|
||||
layout_mode = 1
|
||||
|
|
|
@ -130,7 +130,7 @@ script = ExtResource("12_53j30")
|
|||
search = NodePath("..")
|
||||
prompt_results = NodePath("Panel/VBoxContainer")
|
||||
|
||||
[node name="Panel" type="Panel" parent="Prompt" node_paths=PackedStringArray("search_le")]
|
||||
[node name="Panel" type="Panel" parent="Prompt" node_paths=PackedStringArray("search")]
|
||||
visible = false
|
||||
top_level = true
|
||||
layout_mode = 1
|
||||
|
@ -144,7 +144,7 @@ offset_bottom = 860.0
|
|||
grow_horizontal = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_mh73y")
|
||||
script = ExtResource("13_6kqm6")
|
||||
search_le = NodePath("../..")
|
||||
search = NodePath("../..")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Prompt/Panel" node_paths=PackedStringArray("panel")]
|
||||
layout_mode = 1
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://ca647gp63bshc"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://ca647gp63bshc"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bw1cffhlt112i" path="res://assets/textures/icon-round.svg" id="1_dh3vr"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/menu/bookmark_container.gd" id="1_g38mt"]
|
||||
[ext_resource type="Script" path="res://scripts/ui/menu/scroll_container.gd" id="1_nto68"]
|
||||
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://resources/bookmarks.tres" id="2_2igc6"]
|
||||
[ext_resource type="Script" path="res://addons/max_size_container/max_size_container.gd" id="2_ceb6w"]
|
||||
[ext_resource type="PackedScene" uid="uid://bs2cwop0ei1r1" path="res://scenes/components/search_home.tscn" id="3_guc56"]
|
||||
[ext_resource type="PackedScene" uid="uid://82ca8so31njy" path="res://scenes/components/bookmark.tscn" id="3_isdis"]
|
||||
[ext_resource type="PackedScene" uid="uid://xagbhqfidf2" path="res://scenes/components/round_button.tscn" id="7_bbq84"]
|
||||
[ext_resource type="Texture2D" uid="uid://dy5lmm2egk4w1" path="res://assets/textures/help.svg" id="8_3cxe2"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u8k0c"]
|
||||
bg_color = Color(0.113725, 0.117647, 0.14902, 1)
|
||||
|
@ -40,6 +43,71 @@ VScrollBar/styles/grabber_pressed = SubResource("StyleBoxFlat_6pkf6")
|
|||
VScrollBar/styles/scroll = SubResource("StyleBoxLine_y55p5")
|
||||
VScrollBar/styles/scroll_focus = null
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f0k7f"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 12.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 12.0
|
||||
bg_color = Color(0.12549, 0.133333, 0.172549, 1)
|
||||
corner_radius_top_left = 22
|
||||
corner_radius_top_right = 22
|
||||
corner_radius_bottom_right = 22
|
||||
corner_radius_bottom_left = 22
|
||||
shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314)
|
||||
shadow_size = 4
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2pbt7"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 12.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 12.0
|
||||
bg_color = Color(0.12549, 0.133333, 0.172549, 1)
|
||||
corner_radius_top_left = 22
|
||||
corner_radius_top_right = 22
|
||||
corner_radius_bottom_right = 22
|
||||
corner_radius_bottom_left = 22
|
||||
shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314)
|
||||
shadow_size = 4
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p1ofm"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 12.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 12.0
|
||||
bg_color = Color(0.32549, 0.14902, 0.8, 1)
|
||||
corner_radius_top_left = 22
|
||||
corner_radius_top_right = 22
|
||||
corner_radius_bottom_right = 22
|
||||
corner_radius_bottom_left = 22
|
||||
shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314)
|
||||
shadow_size = 4
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ae6qa"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 12.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 12.0
|
||||
bg_color = Color(0.12549, 0.133333, 0.172549, 1)
|
||||
corner_radius_top_left = 22
|
||||
corner_radius_top_right = 22
|
||||
corner_radius_bottom_right = 22
|
||||
corner_radius_bottom_left = 22
|
||||
shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314)
|
||||
shadow_size = 4
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_37fyt"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 12.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 12.0
|
||||
bg_color = Color(0.12549, 0.133333, 0.172549, 1)
|
||||
corner_radius_top_left = 22
|
||||
corner_radius_top_right = 22
|
||||
corner_radius_bottom_right = 22
|
||||
corner_radius_bottom_left = 22
|
||||
shadow_color = Color(0.0862745, 0.0901961, 0.117647, 0.784314)
|
||||
shadow_size = 4
|
||||
|
||||
[node name="Home" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -58,12 +126,15 @@ grow_vertical = 2
|
|||
theme_override_constants/margin_left = 3
|
||||
theme_override_constants/margin_right = 3
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer" node_paths=PackedStringArray("search")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = SubResource("Theme_vxovh")
|
||||
follow_focus = true
|
||||
horizontal_scroll_mode = 0
|
||||
script = ExtResource("1_nto68")
|
||||
search = NodePath("VBoxContainer/HBoxContainer/VBoxContainer/MaxSizeContainer2/SearchHome")
|
||||
scroll_speed = 44.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer"]
|
||||
clip_contents = true
|
||||
|
@ -107,9 +178,9 @@ size_flags_horizontal = 3
|
|||
[node name="MaxSizeContainer2" type="MarginContainer" parent="MarginContainer/ScrollContainer/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(300, 44)
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 0
|
||||
theme_override_constants/margin_left = 393
|
||||
theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_right = 393
|
||||
theme_override_constants/margin_bottom = 0
|
||||
script = ExtResource("2_ceb6w")
|
||||
limit = Vector2(720, -1)
|
||||
|
@ -126,9 +197,9 @@ custom_minimum_size = Vector2(180, 400)
|
|||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
theme_override_constants/margin_left = 0
|
||||
theme_override_constants/margin_left = 278
|
||||
theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_right = 278
|
||||
theme_override_constants/margin_bottom = 0
|
||||
script = ExtResource("2_ceb6w")
|
||||
limit = Vector2(950, -1)
|
||||
|
@ -154,3 +225,24 @@ layout_mode = 2
|
|||
custom_minimum_size = Vector2(0, 120)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Help" parent="." instance=ExtResource("7_bbq84")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -56.0
|
||||
offset_top = -56.0
|
||||
offset_right = -12.0
|
||||
offset_bottom = -12.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_f0k7f")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_2pbt7")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_p1ofm")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_ae6qa")
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_37fyt")
|
||||
disabled = true
|
||||
icon = ExtResource("8_3cxe2")
|
||||
|
|
17
app/scripts/ui/menu/scroll_container.gd
Normal file
17
app/scripts/ui/menu/scroll_container.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends ScrollContainer
|
||||
|
||||
@export var search: Search
|
||||
@export var scroll_speed: float
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not search.has_focus(): return
|
||||
if event is not InputEventMouseButton: return
|
||||
if not get_global_rect().has_point(event.position): return
|
||||
if not search.prompt_panel.get_global_rect().has_point(event.position): return
|
||||
|
||||
if event.button_index == MouseButton.MOUSE_BUTTON_WHEEL_UP:
|
||||
scroll_vertical -= scroll_speed * event.factor
|
||||
|
||||
if event.button_index == MouseButton.MOUSE_BUTTON_WHEEL_DOWN:
|
||||
scroll_vertical += scroll_speed * event.factor
|
|
@ -44,7 +44,8 @@ func _input(event: InputEvent) -> void:
|
|||
|
||||
if (event is InputEventMouseButton
|
||||
and not get_global_rect().has_point(event.position)
|
||||
and not prompt_panel.get_global_rect().has_point(event.position)):
|
||||
and not prompt_panel.get_global_rect().has_point(event.position)
|
||||
and not event.button_index in [MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_WHEEL_DOWN]):
|
||||
release_focus()
|
||||
on_release_focus.emit()
|
||||
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
extends Control
|
||||
|
||||
@export var search_le: LineEdit
|
||||
@export var search: Search
|
||||
|
||||
var update_position: bool
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
search_le.resized.connect(change_size)
|
||||
search_le.focus_entered.connect(change_size)
|
||||
search.resized.connect(change_size)
|
||||
search.focus_entered.connect(change_size)
|
||||
|
||||
|
||||
func change_size() -> void:
|
||||
global_position = get_parent().global_position
|
||||
size.x = search_le.size.x
|
||||
size.x = search.size.x
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not search.has_focus(): return
|
||||
|
||||
if (event is InputEventMouseButton
|
||||
and event.button_index in [MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_WHEEL_DOWN]):
|
||||
update_position = true
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not update_position: return
|
||||
|
||||
global_position = get_parent().global_position
|
||||
update_position = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue