Bug 453247

Summary: Paste into Active Layer and Paste at Cursor paste at the wrong locations
Product: [Applications] krita Reporter: tomtomtomreportingin
Component: GeneralAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: Ahmettabak1, amy, halla, ss93078
Priority: NOR Keywords: regression
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Offset when pasting at cursor

Description tomtomtomreportingin 2022-05-01 02:01:28 UTC
git f866b153a4

SUMMARY
In Krita 5.1, if the user copies/cuts a selection and then pastes it using "Paste into Active Layer", it will paste at the center of the canvas instead of the location it was cut from. This is annoying for some use cases such as cutting something from another layer onto another layer. Also, Paste at Cursor always seems to paste at some location nowhere near the cursor but instead to some location relative to it.

These operations work as expected in Krita 5.0. Note: this is with Plasma's clipboard manager Klipper.

STEPS TO REPRODUCE
1. Cut a selected area of a painting.
2. Paste into Active Layer.

1. Cut a selected area of a painting.
2. Paste at Cursor using the shortcut.

OBSERVED RESULT
They aren't pasted where the user would expect.

EXPECTED RESULT
These actions should work like they did in 5.0

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.90.0
Qt Version: 5.12.12 (appimage)
Comment 1 Protoniv 2022-05-01 12:39:18 UTC
Yes, I just want to report it and find your report, confirm this.
In 5.0.5 it will paste at the same position where it cut from, while 5.1.0-f866b153a4 will paste at center canvas.
Comment 2 amyspark 2022-06-21 01:02:28 UTC
re Paste into Active Layer: this may have regressed in commit 84dc357b65f4591573199bca060e82d754b27ce9. The current flow doesn't handle layers, only paint devices.

re Paste at cursor: cannot reproduce with commit c94a346e42. Could you send a video of how you reproduce it?
Comment 3 Bug Janitor Service 2022-06-21 01:56:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1482
Comment 4 tomtomtomreportingin 2022-06-21 02:52:54 UTC
Created attachment 149986 [details]
Offset when pasting at cursor

The offset seems dependent on the position on the canvas where the selection was cut from. If you cut from near the top left edge of the canvas for example, then there is only slight offset when pasting at the cursor. This offset does not exist in 5.0.6.
Comment 5 Bug Janitor Service 2022-06-21 04:35:34 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 6 amyspark 2022-06-21 11:58:50 UTC
Thanks! Just one more thing: if you try drag-and-dropping the image, does it paste at the cursor correctly?
Comment 7 tomtomtomreportingin 2022-06-21 14:23:17 UTC
If you're referring to dragging and dropping from another application, dragging and dropping from Firefox to Krita drops the image somewhere near the top left edge of the canvas, with an empty layer name. There seems to be some bad calculation as it seems to only slightly depend on the position you drop it at. In 5.0.6, it always drops it at the center (as "Paint Layer X").
Comment 8 amyspark 2022-07-02 00:50:29 UTC
Git commit 6c5a713b51f787a19c5c69aba2f41312cc4c8d33 by L. E. Segovia.
Committed on 02/07/2022 at 00:42.
Pushed by lsegovia into branch 'master'.

Paste into Active Layer: allow native pasting once again

This commit partially reverts commit
84dc357b65f4591573199bca060e82d754b27ce9.

M  +10   -2    libs/ui/actions/KisPasteActionFactories.cpp
M  +30   -1    libs/ui/kis_clipboard.cc
M  +4    -1    libs/ui/kis_clipboard.h

https://invent.kde.org/graphics/krita/commit/6c5a713b51f787a19c5c69aba2f41312cc4c8d33
Comment 9 amyspark 2022-07-02 00:50:37 UTC
Git commit 420e7aeb05ed3faa0cc29db11a77b3aba17e5172 by L. E. Segovia.
Committed on 02/07/2022 at 00:42.
Pushed by lsegovia into branch 'master'.

Consistently position native and bitmap pastes at cursor center

M  +26   -10   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/commit/420e7aeb05ed3faa0cc29db11a77b3aba17e5172
Comment 10 amyspark 2022-07-02 00:51:49 UTC
Git commit 8d0c0c41a218b9c6a2ebddceebdf9e9fb17f4f85 by L. E. Segovia.
Committed on 02/07/2022 at 00:51.
Pushed by lsegovia into branch 'krita/5.1'.

Paste into Active Layer: allow native pasting once again

This commit partially reverts commit
84dc357b65f4591573199bca060e82d754b27ce9.
(cherry picked from commit 6c5a713b51f787a19c5c69aba2f41312cc4c8d33)

M  +10   -2    libs/ui/actions/KisPasteActionFactories.cpp
M  +30   -1    libs/ui/kis_clipboard.cc
M  +4    -1    libs/ui/kis_clipboard.h

https://invent.kde.org/graphics/krita/commit/8d0c0c41a218b9c6a2ebddceebdf9e9fb17f4f85
Comment 11 amyspark 2022-07-02 00:51:57 UTC
Git commit 5b5361c1014219bb9ae1ac87337c0da28f517d43 by L. E. Segovia.
Committed on 02/07/2022 at 00:51.
Pushed by lsegovia into branch 'krita/5.1'.

Consistently position native and bitmap pastes at cursor center
(cherry picked from commit 420e7aeb05ed3faa0cc29db11a77b3aba17e5172)

M  +26   -10   libs/ui/actions/KisPasteActionFactories.cpp

https://invent.kde.org/graphics/krita/commit/5b5361c1014219bb9ae1ac87337c0da28f517d43
Comment 12 ahmett 2022-07-25 08:47:37 UTC
It is stated that it has been fixed for the last beta. This process works the first time. but when it is tried for the second time, it goes to the first copy. and if the onion skin is open it also copies those images.
Comment 13 Halla Rempt 2022-08-02 07:23:02 UTC
It works for me.
Comment 14 amyspark 2022-08-04 16:02:29 UTC
Marking as RESOLVED. If there are further issues, please open a new bug with the affected tool or feature and with a full repro.