added scrolling but scrolls infinitely

This commit is contained in:
Brazly
2026-01-18 14:33:31 +00:00
parent e1a302ff24
commit 0484218760
3 changed files with 25 additions and 3 deletions

View File

@@ -27,6 +27,12 @@ func Get_Camera_Collision():
func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed and crosshair.is_highlighted:
if event.keycode == KEY_PAGEUP:
terminal.ScrollUp()
if event.keycode == KEY_PAGEDOWN:
terminal.ScrollDown()
if event.keycode == KEY_BACKSPACE:
terminal.InputDelChar()

View File

@@ -194,6 +194,21 @@ clear (or cls) : Clear the terminal screen
help : Show this menu
-------------------------")
func ScrollUp():
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
await get_tree().create_timer(.0001).timeout
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value - 10 )
call("ScrollUp")
func ScrollDown():
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
await get_tree().create_timer(.0001).timeout
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value + 10 )
call("ScrollDown")
func GetBottomScroll():
@@ -202,6 +217,7 @@ func GetBottomScroll():
await get_tree().create_timer(.01).timeout
scroll.set_deferred("scroll_vertical", scrollMax)
#scroll.vertical_scroll_mode = ScrollContainer.SCROLL_MODE_SHOW_NEVER
call_deferred("GetBottomScroll")
func UpdateCaretPos():
@@ -209,4 +225,3 @@ func UpdateCaretPos():
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
caret.position.x = char_rect.end.x + 1
caret.position.y = char_rect.position.y
print(char_rect.end.x)

View File

@@ -236,7 +236,8 @@ grow_vertical = 2
[node name="ScrollContainer" type="ScrollContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer"]
layout_mode = 2
vertical_scroll_mode = 3
scroll_horizontal_custom_step = 0.001
scroll_vertical_custom_step = 0.001
[node name="VBoxContainer" type="VBoxContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer/ScrollContainer"]
layout_mode = 2