1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Don't transform content if layer is locked or invisible

This commit is contained in:
Manolis Papadeas 2021-08-30 01:22:13 +03:00
parent ab18e8bdb6
commit 680ab481f3
3 changed files with 12 additions and 0 deletions

View file

@ -28,6 +28,8 @@ func _input(event : InputEvent) -> void:
func draw_start(position : Vector2) -> void:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
_start_pos = position
_offset = position
_undo_data = _get_undo_data()
@ -37,6 +39,8 @@ func draw_start(position : Vector2) -> void:
func draw_move(position : Vector2) -> void:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
# This is true if content transformation has been confirmed (pressed Enter for example)
# while the content is being moved
if _content_transformation_check != selection_node.is_moving_content:
@ -59,6 +63,8 @@ func draw_move(position : Vector2) -> void:
func draw_end(position : Vector2) -> void:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
if _start_pos != Vector2.INF and _content_transformation_check == selection_node.is_moving_content:
if Tools.shift: # Snap to axis
var angle := position.angle_to_point(_start_pos)

View file

@ -75,6 +75,8 @@ func draw_start(position : Vector2) -> void:
if selection_position.y < 0:
offsetted_pos.y -= selection_position.y
if offsetted_pos.x >= 0 and offsetted_pos.y >= 0 and project.selection_bitmap.get_bit(offsetted_pos) and (!Tools.control or Tools.alt) and !Tools.shift and !_ongoing_selection:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
# Move current selection
_move = true
if Tools.alt: # Move selection without content

View file

@ -105,6 +105,8 @@ func _input(event : InputEvent) -> void:
Global.main_viewport.mouse_default_cursor_shape = Input.CURSOR_CROSS
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
if event.pressed:
if gizmo:
Global.has_focus = false
@ -165,6 +167,8 @@ func move_with_arrow_keys(event : InputEvent) -> void:
return
if Global.current_project.has_selection:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return
if is_action_direction_pressed(event) and !arrow_key_move:
arrow_key_move = true
if Input.is_key_pressed(KEY_ALT):