mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix the canvas preview having incorrect zoom when switching between projects
This commit is contained in:
parent
c52870984e
commit
47b20ff5c3
|
@ -52,6 +52,7 @@ Kawan Weege ([@DragonOfWar](https://github.com/DragonOfWar)), Martin Novák ([@n
|
||||||
- Changed pixel grid shortcut on macOS because it conflicted with a system hotkey. [#494](https://github.com/Orama-Interactive/Pixelorama/pull/494)
|
- Changed pixel grid shortcut on macOS because it conflicted with a system hotkey. [#494](https://github.com/Orama-Interactive/Pixelorama/pull/494)
|
||||||
- The shading tool now has correct Hue, Saturation and Value changes, as well as some other tweaks, like limiting the darkening hue to 240 instead of 270. [#519](https://github.com/Orama-Interactive/Pixelorama/pull/519) and [#522](https://github.com/Orama-Interactive/Pixelorama/pull/522)
|
- The shading tool now has correct Hue, Saturation and Value changes, as well as some other tweaks, like limiting the darkening hue to 240 instead of 270. [#519](https://github.com/Orama-Interactive/Pixelorama/pull/519) and [#522](https://github.com/Orama-Interactive/Pixelorama/pull/522)
|
||||||
- The disabled buttons on the light theme are no longer invisible. [#518](https://github.com/Orama-Interactive/Pixelorama/issues/518)
|
- The disabled buttons on the light theme are no longer invisible. [#518](https://github.com/Orama-Interactive/Pixelorama/issues/518)
|
||||||
|
- Fix the canvas preview having incorrect zoom when switching between projects.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
## [v0.8.3] - 2021-05-04
|
## [v0.8.3] - 2021-05-04
|
||||||
|
|
|
@ -125,6 +125,7 @@ var tabs : Tabs
|
||||||
var main_viewport : ViewportContainer
|
var main_viewport : ViewportContainer
|
||||||
var second_viewport : ViewportContainer
|
var second_viewport : ViewportContainer
|
||||||
var small_preview_viewport : ViewportContainer
|
var small_preview_viewport : ViewportContainer
|
||||||
|
var canvas_preview_container : Container
|
||||||
var camera : Camera2D
|
var camera : Camera2D
|
||||||
var camera2 : Camera2D
|
var camera2 : Camera2D
|
||||||
var camera_preview : Camera2D
|
var camera_preview : Camera2D
|
||||||
|
@ -223,7 +224,8 @@ func _ready() -> void:
|
||||||
tabs = control.find_node("Tabs")
|
tabs = control.find_node("Tabs")
|
||||||
main_viewport = control.find_node("ViewportContainer")
|
main_viewport = control.find_node("ViewportContainer")
|
||||||
second_viewport = control.find_node("ViewportContainer2")
|
second_viewport = control.find_node("ViewportContainer2")
|
||||||
small_preview_viewport = control.find_node("PreviewViewportContainer")
|
canvas_preview_container = control.find_node("CanvasPreviewContainer")
|
||||||
|
small_preview_viewport = canvas_preview_container.find_node("PreviewViewportContainer")
|
||||||
camera = main_viewport.find_node("Camera2D")
|
camera = main_viewport.find_node("Camera2D")
|
||||||
camera2 = control.find_node("Camera2D2")
|
camera2 = control.find_node("Camera2D2")
|
||||||
camera_preview = control.find_node("CameraPreview")
|
camera_preview = control.find_node("CameraPreview")
|
||||||
|
|
|
@ -32,6 +32,7 @@ var has_selection := false
|
||||||
# For every camera (currently there are 3)
|
# 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_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
|
var cameras_offset := [Vector2.ZERO, Vector2.ZERO, Vector2.ZERO] # Array of Vector2
|
||||||
|
var cameras_zoom_max := [Vector2.ONE, Vector2.ONE, Vector2.ONE] # Array of Vector2
|
||||||
|
|
||||||
# Export directory path and export file name
|
# Export directory path and export file name
|
||||||
var directory_path := ""
|
var directory_path := ""
|
||||||
|
@ -228,6 +229,12 @@ func change_project() -> void:
|
||||||
|
|
||||||
var i := 0
|
var i := 0
|
||||||
for camera in [Global.camera, Global.camera2, Global.camera_preview]:
|
for camera in [Global.camera, Global.camera2, Global.camera_preview]:
|
||||||
|
camera.zoom_max = cameras_zoom_max[i]
|
||||||
|
if camera == Global.camera_preview:
|
||||||
|
Global.preview_zoom_slider.disconnect("value_changed", Global.canvas_preview_container, "_on_PreviewZoomSlider_value_changed")
|
||||||
|
Global.preview_zoom_slider.min_value = -camera.zoom_max.x
|
||||||
|
Global.preview_zoom_slider.connect("value_changed", Global.canvas_preview_container, "_on_PreviewZoomSlider_value_changed")
|
||||||
|
|
||||||
camera.zoom = cameras_zoom[i]
|
camera.zoom = cameras_zoom[i]
|
||||||
camera.offset = cameras_offset[i]
|
camera.offset = cameras_offset[i]
|
||||||
camera.zoom_changed()
|
camera.zoom_changed()
|
||||||
|
|
|
@ -273,9 +273,12 @@ func save_values_to_project() -> void:
|
||||||
if name == "Camera2D":
|
if name == "Camera2D":
|
||||||
Global.current_project.cameras_zoom[0] = zoom
|
Global.current_project.cameras_zoom[0] = zoom
|
||||||
Global.current_project.cameras_offset[0] = offset
|
Global.current_project.cameras_offset[0] = offset
|
||||||
|
Global.current_project.cameras_zoom_max[0] = zoom_max
|
||||||
elif name == "Camera2D2":
|
elif name == "Camera2D2":
|
||||||
Global.current_project.cameras_zoom[1] = zoom
|
Global.current_project.cameras_zoom[1] = zoom
|
||||||
Global.current_project.cameras_offset[1] = offset
|
Global.current_project.cameras_offset[1] = offset
|
||||||
|
Global.current_project.cameras_zoom_max[1] = zoom_max
|
||||||
elif name == "CameraPreview":
|
elif name == "CameraPreview":
|
||||||
Global.current_project.cameras_zoom[2] = zoom
|
Global.current_project.cameras_zoom[2] = zoom
|
||||||
Global.current_project.cameras_offset[2] = offset
|
Global.current_project.cameras_offset[2] = offset
|
||||||
|
Global.current_project.cameras_zoom_max[2] = zoom_max
|
||||||
|
|
Loading…
Reference in a new issue