Bug 429637

Summary: Discrete canvas rotation mode is skipping an angle
Product: [Applications] krita Reporter: lempikq
Component: GeneralAssignee: Reinold Rojas <rojasreinold>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, rojasreinold
Priority: NOR    
Version: 4.4.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description lempikq 2020-11-25 12:25:55 UTC
SUMMARY
Using discrete canvas rotation mode skips an angle in rotation.
It's all time present but it skips different angles so you might need to rotate all 360degs to find it.

For me it always starts around 0 it goes to 15° then if I want to go back it goes to -15° so a 30° step while all the other angles have a 15° step so this is how it looks:
... -45° <- -30° <- -15 <- 15° -> 30° -> 45° ...
After rotating around for a bit the 30° step shifts to a different angle for example to: -60° -75° -105° -120°

STEPS TO REPRODUCE
1. Use discrete canvas rotation
2. Watch how angles change

OBSERVED RESULT
Angular step is irregular at one point during rotation going from 15° to 30° just for one angle change the rest is 15° again.

EXPECTED RESULT
Same step for every angle change (in this case I believe Krita uses a step = (360° / 24).

ADDITIONAL INFORMATION
In this thread there's a user who confirmed it:
https://krita-artists.org/t/bug-discrete-canvas-rotation-mode-is-missing-an-angle/14714
(I hope this is a bug, if it's a feature I'm sorry for the report)

SOFTWARE/OS VERSIONS
Krita
  Version: 4.4.1

Qt
  Version (compiled): 5.12.9
  Version (loaded): 5.12.9

OS Information
  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19041
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10


OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (NVIDIA GeForce GTX 1660 Ti Direct3D11 vs_5_0 ps_5_0)" 
  Version:  "OpenGL ES 3.0 (ANGLE 2.1.0.57ea533f79a7)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0.57ea533f79a7)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: true 

Hardware Information
 Memory: 31 Gb
 Cores: 6
 Swap: C:/Users/user/AppData/Local/Temp
Comment 1 Ahab Greybeard 2020-11-25 15:23:28 UTC
I see this with the Nov 24 4.4.3 alpha (git 33c35a6) appimage on Debian 10 with a mouse and with a stylus.

It often happens around the zero rotation point but I've also had it go from -30 to zero and from 75 to 105.
When it happens, it continuously happens around that point. You can make it go back to 15 deg. steps by releasing the mouse click (lift the stylus) then re-click and move again.

I doubt that it's a feature :) Setting to Confirmed.
Comment 2 Bug Janitor Service 2021-10-31 07:01:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1134
Comment 3 Halla Rempt 2021-11-02 12:27:55 UTC
Git commit de158f5e538cb40ec37eba00670a8be3567d066b by Halla Rempt, on behalf of Reinold Rojas.
Committed on 02/11/2021 at 12:27.
Pushed by rempt into branch 'master'.

Fix Discrete Canvas Rotation sometimes skipping steps

Before this commit the Discrete Canvas Rotation mode would
be unable to snap to the original rotation if starting
from an angle that was a multiple of 15. This was due to the
mode trying to ignore snapping to that angle at the start
of the action, but was applied through the whole action.
This commit fixes that issue.

M  +4    -1    libs/ui/input/kis_rotate_canvas_action.cpp

https://invent.kde.org/graphics/krita/commit/de158f5e538cb40ec37eba00670a8be3567d066b
Comment 4 Halla Rempt 2021-11-02 12:28:10 UTC
Git commit 9078bf0aae1e09d5ce5d86f51e4f1966a4de630e by Halla Rempt, on behalf of Reinold Rojas.
Committed on 02/11/2021 at 12:28.
Pushed by rempt into branch 'krita/5.0'.

Fix Discrete Canvas Rotation sometimes skipping steps

Before this commit the Discrete Canvas Rotation mode would
be unable to snap to the original rotation if starting
from an angle that was a multiple of 15. This was due to the
mode trying to ignore snapping to that angle at the start
of the action, but was applied through the whole action.
This commit fixes that issue.
(cherry picked from commit de158f5e538cb40ec37eba00670a8be3567d066b)

M  +4    -1    libs/ui/input/kis_rotate_canvas_action.cpp

https://invent.kde.org/graphics/krita/commit/9078bf0aae1e09d5ce5d86f51e4f1966a4de630e