Camera zoom and offset are now project properites

The zoom/offset of the three cameras now get saved in each project, and change when you change project.
This commit is contained in:
OverloadedOrama 2020-06-05 21:03:34 +03:00
parent 9ffce37c0b
commit 2c409ab025
4 changed files with 34 additions and 13 deletions

View file

@ -22,6 +22,10 @@ var x_max := 64
var y_min := 0
var y_max := 64
# For every camera (currently there are 3)
var cameras_zoom := [Vector2(0.15, 0.15), Vector2(0.15, 0.15), Vector2(0.15, 0.15)] # Array of Vector2
var cameras_offset := [Vector2.ZERO, Vector2.ZERO, Vector2.ZERO] # Array of Vector2
func _init(_frames := [], _name := tr("untitled"), _size := Vector2(64, 64)) -> void:
frames = _frames
@ -115,6 +119,13 @@ func change_project() -> void:
for brush in brushes:
Global.create_brush_button(brush)
var cameras = [Global.camera, Global.camera2, Global.camera_preview]
var i := 0
for camera in cameras:
camera.zoom = cameras_zoom[i]
camera.offset = cameras_offset[i]
i += 1
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
Global.canvas.update()
Global.transparent_checker._ready()
Global.window_title = "%s - Pixelorama %s" % [name, Global.current_version]