mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-22 13:33:13 +00:00
Fix Copy & Delete to work on the currently selected parts of the image
This also fixed a crash when deleting while content is being moved/resized
This commit is contained in:
parent
fccd37360a
commit
1d5b44fad2
1 changed files with 27 additions and 14 deletions
|
@ -379,9 +379,12 @@ func copy() -> void:
|
||||||
return
|
return
|
||||||
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
||||||
var to_copy := Image.new()
|
var to_copy := Image.new()
|
||||||
|
if is_moving_content:
|
||||||
|
to_copy.copy_from(preview_image)
|
||||||
|
else:
|
||||||
to_copy = image.get_rect(big_bounding_rectangle)
|
to_copy = image.get_rect(big_bounding_rectangle)
|
||||||
to_copy.lock()
|
to_copy.lock()
|
||||||
# Only remove unincluded pixels if the selection is not a single rectangle
|
# Remove unincluded pixels if the selection is not a single rectangle
|
||||||
for x in to_copy.get_size().x:
|
for x in to_copy.get_size().x:
|
||||||
for y in to_copy.get_size().y:
|
for y in to_copy.get_size().y:
|
||||||
var pos := Vector2(x, y)
|
var pos := Vector2(x, y)
|
||||||
|
@ -427,6 +430,16 @@ func delete() -> void:
|
||||||
var project := Global.current_project
|
var project := Global.current_project
|
||||||
if !project.has_selection:
|
if !project.has_selection:
|
||||||
return
|
return
|
||||||
|
if is_moving_content:
|
||||||
|
is_moving_content = false
|
||||||
|
original_preview_image = Image.new()
|
||||||
|
preview_image = Image.new()
|
||||||
|
original_bitmap = BitMap.new()
|
||||||
|
is_pasting = false
|
||||||
|
update()
|
||||||
|
commit_undo("Draw", undo_data)
|
||||||
|
return
|
||||||
|
|
||||||
var _undo_data = _get_undo_data(true)
|
var _undo_data = _get_undo_data(true)
|
||||||
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
var image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
||||||
for x in big_bounding_rectangle.size.x:
|
for x in big_bounding_rectangle.size.x:
|
||||||
|
|
Loading…
Add table
Reference in a new issue