mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 08:24:44 -04:00
Fix layer name change
Name change is now saved only if the user presses Enter
This commit is contained in:
parent
60aed9efba
commit
0945a558d2
3 changed files with 6 additions and 6 deletions
|
@ -58,4 +58,3 @@ caret_blink = true
|
|||
caret_blink_speed = 0.5
|
||||
[connection signal="pressed" from="." to="." method="_on_LayerContainer_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/VisibilityButton" to="." method="_on_VisibilityButton_pressed"]
|
||||
[connection signal="text_changed" from="HBoxContainer/LineEdit" to="." method="_on_LineEdit_text_changed"]
|
||||
|
|
|
@ -537,8 +537,10 @@ func layers_changed(value : Array) -> void:
|
|||
|
||||
for i in range(layers.size() - 1, -1, -1):
|
||||
var layer_container = load("res://Prefabs/LayerContainer.tscn").instance()
|
||||
layers[i][0] = tr("Layer") + " %s" % i
|
||||
layer_container.i = i
|
||||
if !layers[i][0]:
|
||||
layers[i][0] = tr("Layer") + " %s" % i
|
||||
|
||||
layer_container.get_child(0).get_child(1).text = layers[i][0]
|
||||
layer_container.get_child(0).get_child(2).text = layers[i][0]
|
||||
layers_container.add_child(layer_container)
|
||||
|
|
|
@ -23,6 +23,9 @@ func _input(event : InputEvent) -> void:
|
|||
label.visible = true
|
||||
line_edit.visible = false
|
||||
line_edit.editable = false
|
||||
var new_text : String = line_edit.text
|
||||
label.text = new_text
|
||||
Global.layers[i][0] = new_text
|
||||
|
||||
func _on_LayerContainer_pressed() -> void:
|
||||
var initially_pressed := pressed
|
||||
|
@ -85,7 +88,3 @@ func _on_VisibilityButton_pressed() -> void:
|
|||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type)
|
||||
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type)
|
||||
Global.canvas.update()
|
||||
|
||||
func _on_LineEdit_text_changed(new_text : String) -> void:
|
||||
Global.layers[i][0] = new_text
|
||||
label.text = new_text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue