mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 21:46:20 +00:00
Fix regression using Ctrl+C, Ctrl+N, Enter, Ctrl+V
A common use case is copying a part of one sprite (Ctrl+C), creating a new image with the clipboard size (Ctrl+N, Enter), and pasting the clipboard (Ctrl+V). The pasted sprite must be inside the sprite bounds. Bug report: https://community.aseprite.org/t/problem-pasting-clipboard-content-in-new-image-v1-2-beta10/108
This commit is contained in:
parent
f329f8b50c
commit
b92907237e
@ -2079,9 +2079,17 @@ void Editor::pasteImage(const Image* image, const Mask* mask)
|
||||
y = MID(visibleBounds.y-image->height(), y, visibleBounds.y+visibleBounds.h-1);
|
||||
}
|
||||
|
||||
// Also we always limit the 1 image pixel inside the sprite's bounds.
|
||||
x = MID(-image->width()+1, x, sprite->width()-1);
|
||||
y = MID(-image->height()+1, y, sprite->height()-1);
|
||||
// Limit the image inside the sprite's bounds.
|
||||
if (sprite->width() <= image->width() ||
|
||||
sprite->height() <= image->height()) {
|
||||
x = MID(0, x, sprite->width() - image->width());
|
||||
y = MID(0, y, sprite->height() - image->height());
|
||||
}
|
||||
else {
|
||||
// Also we always limit the 1 image pixel inside the sprite's bounds.
|
||||
x = MID(-image->width()+1, x, sprite->width()-1);
|
||||
y = MID(-image->height()+1, y, sprite->height()-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear brush preview, as the extra cel will be replaced with the
|
||||
|
Loading…
Reference in New Issue
Block a user