1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-30 23:19:49 +00:00

Select layer when clicking a layer button (visible, lock, etc)

This commit is contained in:
Manolis Papadeas 2022-03-17 00:12:00 +02:00
parent bffc36a018
commit 21b4f3369f

View file

@ -63,18 +63,15 @@ func _on_LayerContainer_gui_input(event: InputEvent) -> void:
var frame_layer := [i, j]
if !project.selected_cels.has(frame_layer):
project.selected_cels.append(frame_layer)
project.current_layer = layer
elif Input.is_action_pressed("ctrl"):
for i in range(0, project.frames.size()):
var frame_layer := [i, layer]
if !project.selected_cels.has(frame_layer):
project.selected_cels.append(frame_layer)
project.current_layer = layer
else: # If the button is pressed without Shift or Control
project.selected_cels.clear()
var frame_layer := [project.current_frame, layer]
if !project.selected_cels.has(frame_layer):
project.selected_cels.append(frame_layer)
project.current_layer = layer
_select_current_layer()
if event.doubleclick:
label.visible = false
@ -100,11 +97,13 @@ func _on_VisibilityButton_pressed() -> void:
Global.canvas.selection.transform_content_confirm()
Global.current_project.layers[layer].visible = !Global.current_project.layers[layer].visible
Global.canvas.update()
_select_current_layer()
func _on_LockButton_pressed() -> void:
Global.canvas.selection.transform_content_confirm()
Global.current_project.layers[layer].locked = !Global.current_project.layers[layer].locked
_select_current_layer()
func _on_LinkButton_pressed() -> void:
@ -119,9 +118,19 @@ func _on_LinkButton_pressed() -> void:
var container = Global.frames_container.get_child(Global.current_project.current_layer)
container.get_child(Global.current_project.current_frame).button_setup()
_select_current_layer()
Global.current_project.layers = Global.current_project.layers # Call the setter
func _select_current_layer() -> void:
Global.current_project.selected_cels.clear()
var frame_layer := [Global.current_project.current_frame, layer]
if !Global.current_project.selected_cels.has(frame_layer):
Global.current_project.selected_cels.append(frame_layer)
Global.current_project.current_layer = layer
func get_drag_data(_position) -> Array:
var button := Button.new()
button.rect_size = rect_size