fixed text overflowing at the bottom by always setting the scroll value to be the max
This commit is contained in:
@@ -59,7 +59,7 @@ func EnterCommand() -> void:
|
||||
var userInput = fullText.trim_prefix("user@work " + directory).strip_edges()
|
||||
var parts = userInput.to_lower().split(" ")
|
||||
|
||||
if historyContainer.get_child_count() <22:
|
||||
if historyContainer.get_child_count() <24:
|
||||
CreateHistoryEntry(fullText)
|
||||
|
||||
match parts[0]:
|
||||
@@ -107,6 +107,7 @@ func EnterCommand() -> void:
|
||||
terminalLine.text = "user@work "+ directory + " "
|
||||
|
||||
UpdateCaretPos()
|
||||
GetBottomScroll()
|
||||
|
||||
# --- History and FileSystem Helpers ---
|
||||
func CreateHistoryEntry(content: String) -> void:
|
||||
@@ -124,10 +125,6 @@ func CreateHistoryEntry(content: String) -> void:
|
||||
historyContainer.add_child(label)
|
||||
historyContainer.move_child(label, historyContainer.get_child_count() - 2)
|
||||
|
||||
# Limit history to 15 entries + 1 active line
|
||||
if historyContainer.get_child_count() > 17:
|
||||
historyContainer.get_child(0).queue_free()
|
||||
|
||||
func ResolvePath(current: String, target: String) -> String:
|
||||
if target.begins_with("~/"):
|
||||
return target if target.ends_with("/") else target + "/"
|
||||
@@ -188,9 +185,6 @@ func RetrieveData(inputPath: String):
|
||||
CreateHistoryEntry("cat: " + targetFileName + ": No such file or directory")
|
||||
|
||||
func Help(commandName: String = "default"):
|
||||
for child in historyContainer.get_children():
|
||||
if child != terminalLine:
|
||||
child.queue_free()
|
||||
match commandName:
|
||||
"default": CreateHistoryEntry("--- AVAILABLE COMMANDS ---
|
||||
ls (or list) [folder] : List all files and directories/folders
|
||||
@@ -202,7 +196,13 @@ help : Show this menu
|
||||
|
||||
|
||||
|
||||
func GetBottomScroll():
|
||||
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
|
||||
var scrollMax: float = scroll.get_v_scroll_bar().max_value
|
||||
|
||||
await get_tree().create_timer(.01).timeout
|
||||
scroll.set_deferred("scroll_vertical", scrollMax)
|
||||
call_deferred("GetBottomScroll")
|
||||
|
||||
func UpdateCaretPos():
|
||||
var last_char_index = terminalLine.text.length() - 1
|
||||
|
||||
@@ -215,7 +215,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0478516, 0.229821, 0.058227
|
||||
shape = SubResource("BoxShape3D_nmbs0")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Interactables/PC"]
|
||||
transform = Transform3D(0.024902493, 0.0022058422, 0, -0.0022058422, 0.024902493, 0, 0, 0, 0.024999999, 0.053893626, 0.2870214, 0.041617036)
|
||||
transform = Transform3D(0.024902493, 0.0022058422, 0, -0.0022058422, 0.024902493, 0, 0, 0, 0.024999999, 0.053893626, 0.32362998, 0.038876176)
|
||||
layers = 2
|
||||
flip_h = true
|
||||
axis = 0
|
||||
@@ -223,7 +223,7 @@ texture = SubResource("ViewportTexture_vwrhx")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="Interactables/PC/Sprite3D" node_paths=PackedStringArray("terminalLine")]
|
||||
transparent_bg = true
|
||||
size = Vector2i(1830, 1680)
|
||||
size = Vector2i(1830, 1400)
|
||||
script = ExtResource("10_gba58")
|
||||
terminalLine = NodePath("MarginContainer/ScrollContainer/VBoxContainer/Label")
|
||||
|
||||
@@ -236,6 +236,7 @@ grow_vertical = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer"]
|
||||
layout_mode = 2
|
||||
vertical_scroll_mode = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cmyf6lhbn1x6p"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://djt7surq1h8bt" path="res://Assets/Model/Interior/Security_Office/security office.UwU.glb" id="1_o43w0"]
|
||||
[ext_resource type="PackedScene" uid="uid://b56h0sioa3yax" path="res://Assets/Model/Interior/Security_Office/security office.UwU.glb" id="1_o43w0"]
|
||||
|
||||
[node name="security office_UwU" instance=ExtResource("1_o43w0")]
|
||||
|
||||
Reference in New Issue
Block a user