Skip to content

Fix the canvas rotation drift

This patch changes how the canvas rotation is calculated. Previously the rotation was applied continuously, updating the canvas transformation with very small angle increments, which led to numerical error accumulating throughout the operation.

The new method is modal. When canvas rotation action begins, the current transformation is saved and used as the base, while the user adjusts the angle. Once the action ends, the final transformation is applied in one go.

EDIT 3/27/2023: With the last update I verified on an Android tablet with Rotate Mode touch events (rotate without zoom) and it's working correctly.

BUG: 409894

Test Plan

Just create a new document and rotate canvas through various means. The fix is specifically for fine-grained rotation (SHIFT+SPACE drag). I tested on Windows and checked interactions of various rotation methods (discrete, and with the controls on the status bar).

This forum post shows the before and after behavior: LINK

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work (on Windows).
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) Canvas rotate test is marked as broken.
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Maciej Jesionowski

Merge request reports