mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-26 07:14:42 -04:00
Added play button and zoom slider for the small canvas preview
May also be a solution for the age old issue #25.
This commit is contained in:
parent
ebc9eab773
commit
7269b45fc5
10 changed files with 173 additions and 35 deletions
20
src/UI/CanvasPreviewContainer.gd
Normal file
20
src/UI/CanvasPreviewContainer.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends HBoxContainer
|
||||
|
||||
|
||||
onready var canvas_preview = $PreviewContainer/PreviewViewportContainer/Viewport/CanvasPreview
|
||||
onready var camera : Camera2D = $PreviewContainer/PreviewViewportContainer/Viewport/CameraPreview
|
||||
onready var play_button : Button = $SettingsContainer/VBoxContainer/PlayButton
|
||||
|
||||
|
||||
func _on_PreviewZoomSlider_value_changed(value : float) -> void:
|
||||
camera.zoom = -Vector2(value, value)
|
||||
camera.save_values_to_project()
|
||||
|
||||
|
||||
func _on_PlayButton_toggled(button_pressed : bool) -> void:
|
||||
if button_pressed:
|
||||
canvas_preview.animation_timer.start()
|
||||
Global.change_button_texturerect(play_button.get_child(0), "pause.png")
|
||||
else:
|
||||
canvas_preview.animation_timer.stop()
|
||||
Global.change_button_texturerect(play_button.get_child(0), "play.png")
|
Loading…
Add table
Add a link
Reference in a new issue