Bug 459111

Summary: Pasted data in image created from clipboard is placed at the position of the original selection.
Product: [Applications] krita Reporter: Alex May <psychicteeth>
Component: GeneralAssignee: vanyossi <ghevan>
Status: RESOLVED FIXED    
Severity: normal CC: ghevan, halla
Priority: NOR    
Version: 5.1.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Alex May 2022-09-14 15:52:04 UTC
SUMMARY
Copying image data from a large image and pasting it into a new image created using "create from clipboard" leaves it offset from the new canvas and invisible until transformed to bring it back to the visible area.


STEPS TO REPRODUCE
1. Open or create an image
2. Select a small area of the image
3. Copy to clipboard
4. Create new image, selecting Create From Clipboard
5. Paste the copied data

OBSERVED RESULT
The pasted data is invisible. Selecting the Transform Tool and zooming out reveals that the data has been placed where it was in the original image, even though that's off the canvas in the new image

EXPECTED RESULT
The pasted data should be visible.

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2022-09-20 12:09:12 UTC
The last step -- the paste does produce this issue. It's not necessary to create from clipboard.
Comment 2 vanyossi 2022-09-30 02:03:24 UTC
I suppose if the paste data is outside the image, we can change behavior either to
A: paste at current cursor position
B: paste at top left corner of the document
Comment 3 Bug Janitor Service 2022-10-01 05:40:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1602
Comment 4 Dmitry Kazakov 2022-10-28 11:00:20 UTC
Git commit e41db7b620a6d8197a44ce7cddb5f16ea59d1878 by Dmitry Kazakov, on behalf of Ivan Yossi.
Committed on 28/10/2022 at 10:59.
Pushed by dkazakov into branch 'master'.

Fix paste outside of image boundaries

If paste data does not intersect canvas, the image is pasted
at the center of the canvas.

M  +27   -12   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/commit/e41db7b620a6d8197a44ce7cddb5f16ea59d1878
Comment 5 Dmitry Kazakov 2022-10-28 11:01:36 UTC
Git commit 2292eb10386376a4c6c08c298303672a45f044f5 by Dmitry Kazakov, on behalf of Ivan Yossi.
Committed on 28/10/2022 at 11:01.
Pushed by dkazakov into branch 'krita/5.1'.

Fix paste outside of image boundaries

If paste data does not intersect canvas, the image is pasted
at the center of the canvas.


(cherry picked from commit e41db7b620a6d8197a44ce7cddb5f16ea59d1878)

M  +27   -12   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/commit/2292eb10386376a4c6c08c298303672a45f044f5