Fix viewport size not updating correctly in many cases for subsampling
This commit is contained in:
parent
bcdd85f884
commit
ea1ed1fa17
|
@ -206,7 +206,6 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[connection signal="item_rect_changed" from="Square" to="Square/NoteHandler/Viewport" method="_on_Square_item_rect_changed"]
|
|
||||||
[connection signal="combo_changed" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"]
|
[connection signal="combo_changed" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_combo_changed"]
|
||||||
[connection signal="finished_song" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_finished_song"]
|
[connection signal="finished_song" from="Square/NoteHandler" to="Square/NoteHandler/lbl_combo" method="_on_NoteHandler_finished_song"]
|
||||||
[connection signal="column_pressed" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_pressed"]
|
[connection signal="column_pressed" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_pressed"]
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
extends Viewport
|
extends Viewport
|
||||||
|
|
||||||
|
export var SquarePath := @'../../'
|
||||||
|
onready var Square := get_node(SquarePath)
|
||||||
|
onready var Root := $'/root'
|
||||||
onready var base_height = 1080.0
|
onready var base_height = 1080.0
|
||||||
|
|
||||||
var container_size := Vector2(1080, 1080)
|
var container_size := Vector2(1080, 1080)
|
||||||
|
@ -10,17 +13,15 @@ func set_render_scale(scale: Vector2):
|
||||||
$Center.position = size * 0.5
|
$Center.position = size * 0.5
|
||||||
$Center.scale = size/base_height
|
$Center.scale = size/base_height
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
func update_size() -> void:
|
||||||
func _ready():
|
|
||||||
Settings.connect('subsampling_changed', self, 'set_render_scale')
|
|
||||||
set_render_scale(Settings.subsampling)
|
|
||||||
_on_Square_item_rect_changed()
|
|
||||||
|
|
||||||
|
|
||||||
onready var Square := $'../../'
|
|
||||||
onready var Root := $'/root'
|
|
||||||
onready var Main := $'/root/main'
|
|
||||||
func _on_Square_item_rect_changed() -> void:
|
|
||||||
var winscale = min(Root.size.x, Root.size.y)/base_height
|
var winscale = min(Root.size.x, Root.size.y)/base_height
|
||||||
container_size = Square.rect_size * winscale
|
container_size = Square.rect_size * winscale
|
||||||
set_render_scale(scale)
|
set_render_scale(scale)
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
Settings.connect('subsampling_changed', self, 'set_render_scale')
|
||||||
|
Square.connect('item_rect_changed', self, 'update_size')
|
||||||
|
Root.connect('size_changed', self, 'update_size')
|
||||||
|
scale = Settings.subsampling
|
||||||
|
update_size()
|
||||||
|
|
Loading…
Reference in New Issue