mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 09:39:48 +00:00
The selected layer's buttons are now pressed
The unselected layers's buttons are pressed = false
This commit is contained in:
parent
24818bfaea
commit
87629fdf2f
|
@ -529,6 +529,9 @@ func layers_changed(value : Array) -> void:
|
||||||
|
|
||||||
layers[i][2].add_child(frame_button)
|
layers[i][2].add_child(frame_button)
|
||||||
|
|
||||||
|
var layer_button = layers_container.get_child(layers_container.get_child_count() - 1 - current_layer)
|
||||||
|
layer_button.pressed = true
|
||||||
|
|
||||||
if layers.size() == 1:
|
if layers.size() == 1:
|
||||||
remove_layer_button.disabled = true
|
remove_layer_button.disabled = true
|
||||||
remove_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
remove_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||||
|
@ -568,6 +571,14 @@ func layer_changed(value : int) -> void:
|
||||||
current_layer = value
|
current_layer = value
|
||||||
layer_opacity_slider.value = canvas.layers[current_layer][2] * 100
|
layer_opacity_slider.value = canvas.layers[current_layer][2] * 100
|
||||||
layer_opacity_spinbox.value = canvas.layers[current_layer][2] * 100
|
layer_opacity_spinbox.value = canvas.layers[current_layer][2] * 100
|
||||||
|
|
||||||
|
for container in layers_container.get_children():
|
||||||
|
container.pressed = false
|
||||||
|
|
||||||
|
if current_layer < layers_container.get_child_count():
|
||||||
|
var layer_button = layers_container.get_child(layers_container.get_child_count() - 1 - current_layer)
|
||||||
|
layer_button.pressed = true
|
||||||
|
|
||||||
if current_layer < layers.size() - 1:
|
if current_layer < layers.size() - 1:
|
||||||
move_up_layer_button.disabled = false
|
move_up_layer_button.disabled = false
|
||||||
move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||||
|
|
|
@ -10,7 +10,6 @@ onready var label := $HBoxContainer/Label
|
||||||
onready var line_edit := $HBoxContainer/LineEdit
|
onready var line_edit := $HBoxContainer/LineEdit
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
#changed_selection()
|
|
||||||
if Global.layers[i][1]:
|
if Global.layers[i][1]:
|
||||||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type)
|
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)
|
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type)
|
||||||
|
@ -28,11 +27,9 @@ func _input(event : InputEvent) -> void:
|
||||||
Global.layers[i][0] = new_text
|
Global.layers[i][0] = new_text
|
||||||
|
|
||||||
func _on_LayerContainer_pressed() -> void:
|
func _on_LayerContainer_pressed() -> void:
|
||||||
var initially_pressed := pressed
|
pressed = !pressed
|
||||||
var label_initially_visible : bool = label.visible
|
var label_initially_visible : bool = label.visible
|
||||||
# Global.canvas.current_layer_index = i
|
|
||||||
# changed_selection()
|
|
||||||
if !initially_pressed:
|
|
||||||
if label_initially_visible:
|
if label_initially_visible:
|
||||||
label.visible = false
|
label.visible = false
|
||||||
line_edit.visible = true
|
line_edit.visible = true
|
||||||
|
@ -43,40 +40,6 @@ func _on_LayerContainer_pressed() -> void:
|
||||||
line_edit.visible = false
|
line_edit.visible = false
|
||||||
line_edit.editable = false
|
line_edit.editable = false
|
||||||
|
|
||||||
func changed_selection() -> void:
|
|
||||||
var parent := get_parent()
|
|
||||||
for child in parent.get_children():
|
|
||||||
if child is Button:
|
|
||||||
child.label.visible = true
|
|
||||||
child.line_edit.visible = false
|
|
||||||
child.line_edit.editable = false
|
|
||||||
if Global.canvas.current_layer_index == child.i: # The selected layer
|
|
||||||
child.currently_selected = true
|
|
||||||
child.pressed = true
|
|
||||||
Global.layer_opacity_slider.value = Global.canvas.layers[child.i][3] * 100
|
|
||||||
Global.layer_opacity_spinbox.value = Global.canvas.layers[child.i][3] * 100
|
|
||||||
|
|
||||||
if Global.canvas.current_layer_index < Global.canvas.layers.size() - 1:
|
|
||||||
Global.move_up_layer_button.disabled = false
|
|
||||||
Global.move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
||||||
else:
|
|
||||||
Global.move_up_layer_button.disabled = true
|
|
||||||
Global.move_up_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
|
||||||
|
|
||||||
if Global.canvas.current_layer_index > 0:
|
|
||||||
Global.move_down_layer_button.disabled = false
|
|
||||||
Global.move_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
||||||
Global.merge_down_layer_button.disabled = false
|
|
||||||
Global.merge_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
||||||
else:
|
|
||||||
Global.move_down_layer_button.disabled = true
|
|
||||||
Global.move_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
|
||||||
Global.merge_down_layer_button.disabled = true
|
|
||||||
Global.merge_down_layer_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
|
||||||
else:
|
|
||||||
child.currently_selected = false
|
|
||||||
child.pressed = false
|
|
||||||
|
|
||||||
func _on_VisibilityButton_pressed() -> void:
|
func _on_VisibilityButton_pressed() -> void:
|
||||||
if Global.layers[i][1]:
|
if Global.layers[i][1]:
|
||||||
Global.layers[i][1] = false
|
Global.layers[i][1] = false
|
||||||
|
|
Loading…
Reference in a new issue