Bug 472120 - Move tool reverts previous transform operation
Summary: Move tool reverts previous transform operation
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Move (show other bugs)
Version: 5.1.4
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-10 04:12 UTC by Ryan
Modified: 2023-07-24 09:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
reproduction steps (1.70 MB, image/gif)
2023-07-10 05:08 UTC, Ryan
Details
full screen reproduction (3.42 MB, video/mp4)
2023-07-17 10:34 UTC, Ryan
Details
performance settings (26.68 KB, image/png)
2023-07-22 07:53 UTC, Ryan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan 2023-07-10 04:12:18 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Paste an image as a new layer into a blank document
2. Ctrl+T free transform the layer, drag the corner to resize it to roughly 50% smaller in width and height. Press enter to commit the transform. Optional: wait for the progress bar in the layers window to finish (this does not significantly affect the reproduction steps).
3. Press keyboard shortcut for move tool (V in photoshop hotkeys) and drag the layer to move it

OBSERVED RESULT
At least 50% of the time the pixels in the layer revert to before step 2 was committed, the layer is the original size. It can be observed in many ways that this is real pixel data and not a rendering artifact. I cannot find any surefire way to reproduce this every time, but if the keyboard shortcuts are used quickly then it (frustratingly) happens almost every time.

EXPECTED RESULT
The layer should move with the mouse and the previous transform should have been permanent, ie. the layer should remain around 50% of the original size and not resize at all when moved.

SOFTWARE/OS VERSIONS
Windows: 10
Mac OSX 

ADDITIONAL INFORMATION
The behaviour is consistent between windows and mac (multiple os versions)
Comment 1 Ryan 2023-07-10 05:08:53 UTC
Created attachment 160219 [details]
reproduction steps

instead of reduction by 50% this video increases the size of the truck layer. on the instant the canvas is clicked with the move tool, it reverts its size to before it was transformed.
Comment 2 Ryan 2023-07-12 01:35:47 UTC
Note: I have built krita from the latest master branch locally and I have sofar been unable to reproduce this problem. does anyone know if it was addressed intentionally as a fix recently? I will keep this posted, if I don't then I haven't been able to reproduce it as I use the latest version daily.
Comment 3 Ryan 2023-07-12 07:34:37 UTC
I reproduced it on latest master (splash screen says 5.2.0 prealpha). Once I did this enough times on enough layers it just started happening almost every time. (around 30 times on 40+ layers)
Comment 4 Dmitry Kazakov 2023-07-17 10:04:58 UTC
Hi, Ryan!

Could you tell, what mode your Transform Tool is set to? Is it "Accurate with Instant Preview" or something else?
Comment 5 Dmitry Kazakov 2023-07-17 10:17:43 UTC
Here are two more questions, btw:

1) Could you make a recording of the full screen? 
2) What is the type of the pasted layer? Isn't it some vector SVG image that is pasted as a Vector Layer?
Comment 6 Dmitry Kazakov 2023-07-17 10:18:01 UTC
Set to waiting for info
Comment 7 Ryan 2023-07-17 10:33:26 UTC
Sure. I didn't think to try those options. It seems to happen consistently if I have it set to Accurate with Instant Preview. If I set it to the other 2 options then it doesn't happen. I have recorded all options and used undo between each one.
Comment 8 Ryan 2023-07-17 10:34:53 UTC
Created attachment 160327 [details]
full screen reproduction

all transform tool modes
Comment 9 Bug Janitor Service 2023-07-18 03:45:11 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 10 Dmitry Kazakov 2023-07-19 15:25:36 UTC
Hi, Ryan!

Could you please share the screenshot of this Preferences page:

Settings->Configure Krita->Performance->Instant Preview

The most interesting thing for me is if instant preview is activated for Move Tool.

Could you also share your testing image with me? You can send it to my email if it is private (dimula73 at gmail com)
Comment 11 Ryan 2023-07-22 07:53:24 UTC
Created attachment 160442 [details]
performance settings

All my settings are standard except for key bindings set to photoshop.
Comment 12 Dmitry Kazakov 2023-07-24 07:49:53 UTC
Hi, Ryan!

Thank you for your help! With your file and other information I have managed to reproduce the issue. It happens only with PS-shortcuts scheme, because V-shortcut conflicts with the Line Tool shortcut, which somehow causes the issue! :)
Comment 13 Dmitry Kazakov 2023-07-24 09:14:17 UTC
Git commit 628ce8ccf5fcc883fba28f1356f14bfc6d2e2a69 by Dmitry Kazakov.
Committed on 24/07/2023 at 11:13.
Pushed by dkazakov into branch 'master'.

Fix resetting a transformation action when switching tools too quickly

The bug was twofold:

1) When the user selects Photoshop-compatible shortcuts scheme, the
   V-shortcut becomes conflicting with line-tool-override shortcut.

2) That caused the transform tool to be activated and then, very briefly,
   deactivated.

3) In some cases, the deactivation could come before
   `slotTransactionGenerated()` was called by the stroke, which left
   the update stream helper to be uninitialized. Therefore the stroke
   didn't receive the final update for the initially undone actions.

4) That caused the action of the tool to be visually undone.

M  +14   -1    libs/ui/tool/KisAsynchronousStrokeUpdateHelper.cpp
M  +23   -0    libs/ui/tool/KisAsynchronousStrokeUpdateHelper.h
M  +4    -1    plugins/tools/tool_transform2/kis_tool_transform.cc

https://invent.kde.org/graphics/krita/-/commit/628ce8ccf5fcc883fba28f1356f14bfc6d2e2a69