1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Have the ResizeCanvas width & height values the same as the project's size the first time

This commit is contained in:
OverloadedOrama 2020-06-24 04:02:19 +03:00
parent 89b6e3a989
commit 90d02ad75b

View file

@ -6,13 +6,20 @@ var height := 64
var offset_x := 0 var offset_x := 0
var offset_y := 0 var offset_y := 0
var image : Image var image : Image
var first_time := true
onready var width_spinbox : SpinBox = $VBoxContainer/OptionsContainer/WidthValue
onready var height_spinbox : SpinBox = $VBoxContainer/OptionsContainer/HeightValue
onready var x_spinbox : SpinBox = $VBoxContainer/OptionsContainer/XSpinBox onready var x_spinbox : SpinBox = $VBoxContainer/OptionsContainer/XSpinBox
onready var y_spinbox : SpinBox = $VBoxContainer/OptionsContainer/YSpinBox onready var y_spinbox : SpinBox = $VBoxContainer/OptionsContainer/YSpinBox
onready var preview_rect : TextureRect = $VBoxContainer/Preview onready var preview_rect : TextureRect = $VBoxContainer/Preview
func _on_ResizeCanvas_about_to_show() -> void: func _on_ResizeCanvas_about_to_show() -> void:
if first_time:
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
image = Image.new() image = Image.new()
image.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8) image.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8)
image.lock() image.lock()
@ -38,6 +45,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
func _on_ResizeCanvas_confirmed() -> void: func _on_ResizeCanvas_confirmed() -> void:
DrawingAlgos.resize_canvas(width, height, offset_x, offset_y) DrawingAlgos.resize_canvas(width, height, offset_x, offset_y)
first_time = false
func _on_WidthValue_value_changed(value : int) -> void: func _on_WidthValue_value_changed(value : int) -> void: