mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-21 13:03:13 +00:00
Do not require confirmation when transforming a selection with invisible contents
This commit is contained in:
parent
729c3ae1af
commit
e86dde2fb5
3 changed files with 14 additions and 8 deletions
|
@ -42,7 +42,9 @@ func draw_end(position : Vector2) -> void:
|
||||||
var project : Project = Global.current_project
|
var project : Project = Global.current_project
|
||||||
var image : Image = _get_draw_image()
|
var image : Image = _get_draw_image()
|
||||||
|
|
||||||
if !project.has_selection:
|
if project.has_selection:
|
||||||
|
Global.canvas.selection.move_borders_end()
|
||||||
|
else:
|
||||||
Global.canvas.move_preview_location = Vector2.ZERO
|
Global.canvas.move_preview_location = Vector2.ZERO
|
||||||
var image_copy := Image.new()
|
var image_copy := Image.new()
|
||||||
image_copy.copy_from(image)
|
image_copy.copy_from(image)
|
||||||
|
|
|
@ -113,7 +113,7 @@ func draw_end(_position : Vector2) -> void:
|
||||||
if selection_node.arrow_key_move:
|
if selection_node.arrow_key_move:
|
||||||
return
|
return
|
||||||
if _move:
|
if _move:
|
||||||
selection_node.move_borders_end(!_move_content)
|
selection_node.move_borders_end()
|
||||||
else:
|
else:
|
||||||
apply_selection(_position)
|
apply_selection(_position)
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,11 @@ func move_with_arrow_keys(event : InputEvent) -> void:
|
||||||
if Input.is_key_pressed(KEY_ALT):
|
if Input.is_key_pressed(KEY_ALT):
|
||||||
transform_content_confirm()
|
transform_content_confirm()
|
||||||
move_borders_start()
|
move_borders_start()
|
||||||
is_moving_content = false
|
|
||||||
else:
|
else:
|
||||||
transform_content_start()
|
transform_content_start()
|
||||||
is_moving_content = true
|
|
||||||
if is_action_direction_released(event) and arrow_key_move:
|
if is_action_direction_released(event) and arrow_key_move:
|
||||||
arrow_key_move = false
|
arrow_key_move = false
|
||||||
move_borders_end(!is_moving_content)
|
move_borders_end()
|
||||||
|
|
||||||
if is_action_direction(event) and arrow_key_move:
|
if is_action_direction(event) and arrow_key_move:
|
||||||
var step := Vector2.ONE
|
var step := Vector2.ONE
|
||||||
|
@ -410,12 +408,12 @@ func move_borders(move : Vector2) -> void:
|
||||||
update()
|
update()
|
||||||
|
|
||||||
|
|
||||||
func move_borders_end(undo := true) -> void:
|
func move_borders_end() -> void:
|
||||||
var selected_bitmap_copy := Global.current_project.selection_bitmap.duplicate()
|
var selected_bitmap_copy := Global.current_project.selection_bitmap.duplicate()
|
||||||
Global.current_project.move_bitmap_values(selected_bitmap_copy)
|
Global.current_project.move_bitmap_values(selected_bitmap_copy)
|
||||||
|
|
||||||
Global.current_project.selection_bitmap = selected_bitmap_copy
|
Global.current_project.selection_bitmap = selected_bitmap_copy
|
||||||
if undo:
|
if !is_moving_content:
|
||||||
commit_undo("Rectangle Select", undo_data)
|
commit_undo("Rectangle Select", undo_data)
|
||||||
else:
|
else:
|
||||||
Global.current_project.selection_bitmap_changed()
|
Global.current_project.selection_bitmap_changed()
|
||||||
|
@ -424,9 +422,12 @@ func move_borders_end(undo := true) -> void:
|
||||||
|
|
||||||
func transform_content_start() -> void:
|
func transform_content_start() -> void:
|
||||||
if !is_moving_content:
|
if !is_moving_content:
|
||||||
is_moving_content = true
|
|
||||||
undo_data = _get_undo_data(true)
|
undo_data = _get_undo_data(true)
|
||||||
get_preview_image()
|
get_preview_image()
|
||||||
|
if original_preview_image.is_empty():
|
||||||
|
undo_data = _get_undo_data(false)
|
||||||
|
return
|
||||||
|
is_moving_content = true
|
||||||
original_bitmap = Global.current_project.selection_bitmap.duplicate()
|
original_bitmap = Global.current_project.selection_bitmap.duplicate()
|
||||||
original_big_bounding_rectangle = big_bounding_rectangle
|
original_big_bounding_rectangle = big_bounding_rectangle
|
||||||
original_offset = Global.current_project.selection_offset
|
original_offset = Global.current_project.selection_offset
|
||||||
|
@ -671,6 +672,9 @@ func get_preview_image() -> void:
|
||||||
original_preview_image.set_pixelv(pos, Color(0, 0, 0, 0))
|
original_preview_image.set_pixelv(pos, Color(0, 0, 0, 0))
|
||||||
|
|
||||||
original_preview_image.unlock()
|
original_preview_image.unlock()
|
||||||
|
if original_preview_image.is_invisible():
|
||||||
|
original_preview_image = Image.new()
|
||||||
|
return
|
||||||
preview_image.copy_from(original_preview_image)
|
preview_image.copy_from(original_preview_image)
|
||||||
preview_image_texture.create_from_image(preview_image, 0)
|
preview_image_texture.create_from_image(preview_image, 0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue