extends Viewport export var squarePath := @'../../' onready var square := get_node(squarePath) onready var root := $'/root' onready var base_height = 1080.0 var container_size := Vector2(1080, 1080) var scale := Vector2(1, 1) func set_render_scale(scale: Vector2): self.scale = scale size = container_size * scale $Center.position = size * 0.5 $Center.scale = size/base_height func update_size() -> void: var winscale = min(root.size.x, root.size.y)/base_height container_size = square.rect_size * winscale 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()