added scrolling but scrolls infinitely
This commit is contained in:
@@ -27,6 +27,12 @@ func Get_Camera_Collision():
|
|||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event is InputEventKey and event.pressed and crosshair.is_highlighted:
|
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:
|
if event.keycode == KEY_BACKSPACE:
|
||||||
|
|
||||||
terminal.InputDelChar()
|
terminal.InputDelChar()
|
||||||
|
|||||||
@@ -194,6 +194,21 @@ clear (or cls) : Clear the terminal screen
|
|||||||
help : Show this menu
|
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():
|
func GetBottomScroll():
|
||||||
@@ -202,6 +217,7 @@ func GetBottomScroll():
|
|||||||
|
|
||||||
await get_tree().create_timer(.01).timeout
|
await get_tree().create_timer(.01).timeout
|
||||||
scroll.set_deferred("scroll_vertical", scrollMax)
|
scroll.set_deferred("scroll_vertical", scrollMax)
|
||||||
|
#scroll.vertical_scroll_mode = ScrollContainer.SCROLL_MODE_SHOW_NEVER
|
||||||
call_deferred("GetBottomScroll")
|
call_deferred("GetBottomScroll")
|
||||||
|
|
||||||
func UpdateCaretPos():
|
func UpdateCaretPos():
|
||||||
@@ -209,4 +225,3 @@ func UpdateCaretPos():
|
|||||||
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
|
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
|
||||||
caret.position.x = char_rect.end.x + 1
|
caret.position.x = char_rect.end.x + 1
|
||||||
caret.position.y = char_rect.position.y
|
caret.position.y = char_rect.position.y
|
||||||
print(char_rect.end.x)
|
|
||||||
|
|||||||
@@ -236,7 +236,8 @@ grow_vertical = 2
|
|||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer"]
|
||||||
layout_mode = 2
|
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"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Interactables/PC/Sprite3D/SubViewport/MarginContainer/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user