mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
handle ui resize in carousel
This commit is contained in:
parent
86ad20e452
commit
9e46290c36
1 changed files with 8 additions and 0 deletions
|
@ -13,6 +13,7 @@ func _ready() -> void:
|
|||
setup_boards()
|
||||
assert(boards.size() > 0, "Carousel must have at least one board")
|
||||
|
||||
ui_events.ui_size_changed.connect(on_ui_size_changed)
|
||||
move_line(0)
|
||||
|
||||
|
||||
|
@ -24,6 +25,13 @@ func setup_boards() -> void:
|
|||
boards[i].request_focus.connect(move_line.bind(i))
|
||||
|
||||
|
||||
func on_ui_size_changed(ui_size: Vector2) -> void:
|
||||
var screen_center = ui_size.y / 2
|
||||
line.position.y = screen_center - line.size.y / 2
|
||||
|
||||
move_line(focused_page)
|
||||
|
||||
|
||||
func move_line(board_index: int) -> void:
|
||||
var board = boards[board_index]
|
||||
focused_page = board_index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue