Made improvements to the Search window, Made small changes to the inspiration list scrolling, Made small changes to the player list, Changed the term game to soundtrack, #28: Made changes to the sync window
This commit is contained in:
1 parent
235bdcbcb5
commit
8da6fc442f
17 files changed
+448
-363
No files matched your search
@@ -1,34 +1,38 @@
|
||||
extends ScrollContainer
|
||||
|
||||
var SCROLL: float = 0
|
||||
var delay: float = 0.02 #seconds
|
||||
var wait: float = 0
|
||||
# Scroll direction: 1 = down, -1 = up
|
||||
var scroll_direction: int = 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
wait = delay
|
||||
scroll_direction = 1
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
wait -= delta
|
||||
if wait < 0:
|
||||
wait = delay
|
||||
#SCROLL DOWN
|
||||
if SCROLL == 1:
|
||||
if (scroll_vertical + get_v_scroll_bar().page) < get_v_scroll_bar().max_value:
|
||||
scroll_vertical += Settings.inspiration_list_speed
|
||||
else:
|
||||
scroll_back_up()
|
||||
#SCROLL UP
|
||||
elif SCROLL == -1:
|
||||
if scroll_vertical != 0:
|
||||
scroll_vertical -= Settings.inspiration_list_speed
|
||||
else:
|
||||
scroll_to_bottom()
|
||||
var speed_pixels_per_second: float = float(Settings.inspiration_list_speed) * 60.0
|
||||
var scroll_amount: float = speed_pixels_per_second * delta * float(scroll_direction)
|
||||
|
||||
var scroll_bar = get_v_scroll_bar()
|
||||
|
||||
# Don't scroll if list is empty or too short
|
||||
if scroll_bar.max_value <= 0:
|
||||
return
|
||||
|
||||
func scroll_back_up() -> void:
|
||||
SCROLL = -1
|
||||
var current_pos = scroll_bar.value
|
||||
|
||||
func scroll_to_bottom() -> void:
|
||||
scroll_vertical = 0 #Reset to top first.
|
||||
SCROLL = 1
|
||||
if scroll_direction == 1:
|
||||
# Scrolling down
|
||||
if current_pos + scroll_bar.page < scroll_bar.max_value:
|
||||
scroll_bar.value = min(current_pos + scroll_amount, scroll_bar.max_value - scroll_bar.page)
|
||||
else:
|
||||
# Reached bottom, reverse direction
|
||||
scroll_direction = -1
|
||||
scroll_bar.value = scroll_bar.max_value - scroll_bar.page
|
||||
else:
|
||||
# Scrolling up
|
||||
if current_pos > 0:
|
||||
scroll_bar.value = max(current_pos + scroll_amount, 0)
|
||||
else:
|
||||
# Reached top, reverse direction
|
||||
scroll_direction = 1
|
||||
scroll_bar.value = 0
|
||||
Reference in new issue
Block a user