tool extends Control class_name SummerDayCanvas var scene: SummerDayScene var canvas_state := SummerDayCanvasState.new() func _ready(): canvas_state.connect("view_transform_changed", $BackgroundLayer/EmptyCanvasLayer, "_on_view_transform_changed") func _gui_input(event): if event is InputEventMagnifyGesture: print(event.factor) if event is InputEventMouseButton: print(event.pressed) func _on_SummerDay_scene_changed(new_scene): scene = new_scene canvas_state.update_fill_transform(scene) scene.connect("aspect_ratio_changed", self, "_on_scene_aspect_ratio_changed") $Label.text = str(scene) + "\n" + str(scene.aspect_ratio) func _on_Canvas_resized(): canvas_state.rect_size = rect_size canvas_state.update_fill_transform(scene) func _on_scene_aspect_ratio_changed(new_aspect_ratio): $BackgroundLayer/EmptyCanvasLayer.update_size(scene) canvas_state.update_fill_transform(scene)