Skip to content

Fix transform tool rotation behaving erratically

Before this commit if a rotation with the transform tool was started below the pivot point the transform would rotate in the opposite direction of the cursor movement at certain points in the rotation. This was due to the transform tool not having the correct clockwise direction from the starting angle in those cases. This commit fixes that by fixing how the clockwise direction is determined.

For this bug to occur the cursor would need to be position below the pivot point at the start of the rotation. Depending on how close the cursor is to 270 degrees at the start of the rotation (if 0 degrees is the middle top of the selection) the "reversed direction" segment may be larger or shorter. The "reversed direction" segment may extend from 0 degrees to 180 at its largest. I recommending testing at just under 270 degrees since its easier to check.

BUG:445731

Test Plan

  1. Choose the transform tool
  2. Start a rotation below the pivot point
  3. Rotate the selection a full 360 degrees (selection should rotate smoothly with no jumps or reversed movement)
  4. repeat above with after scaling the selection and changing the pivot point

Also its probably worthwhile to check with animation curves like described here. This was the original reason for being aware of the clockwise/counter-clockwise direction:

  1. Create a paint layer with a rectangle
  2. Add a transform mask on paint layer
  3. Create first keyframe at frame 0
  4. Move to another frame (example, frame 15)
  5. Select “Transform tool”
  6. Do a counter-clockwise rotation (example -15°)
  7. Play the animation from frame 1 (animation should rotate counter-clockwise)

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • 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.
Edited by reinold rojas

Merge request reports