Skip to content

Fix rotate buttons rotating in the wrong direction#369

Open
Darrkop wants to merge 1 commit into
AlexanderVanhee:mainfrom
Darrkop:fix-rotation-direction
Open

Fix rotate buttons rotating in the wrong direction#369
Darrkop wants to merge 1 commit into
AlexanderVanhee:mainfrom
Darrkop:fix-rotation-direction

Conversation

@Darrkop

@Darrkop Darrkop commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • The rotate-right and rotate-left toolbar buttons rotated the image in the opposite direction of what the icon/button implies.
  • ImageSidebar increments rotation by +90 on rotate-right (clockwise intent) and -90 on rotate-left (counter-clockwise intent).
  • ImageProcessor._apply_rotation mapped rotation == 90 to Image.ROTATE_90, but Pillow's ROTATE_90 transpose is counter-clockwise, and ROTATE_270 is clockwise — so the two cases were swapped, making both buttons rotate opposite to their intent.
  • Swapped the ROTATE_90/ROTATE_270 cases so rotate-right now rotates clockwise and rotate-left rotates counter-clockwise.

Test plan

  • Verified with a quick Pillow script that ROTATE_90 moves a marked top-left pixel to the bottom-left (counter-clockwise), confirming the mapping was inverted.
  • Manually rotate an image left/right in Gradia and confirm it now matches the button direction.

The right-rotate button increments rotation by 90 (clockwise intent),
but ImageProcessor._apply_rotation mapped it to Image.ROTATE_90, which
is Pillow's counter-clockwise 90 degree transpose. Likewise the left
button's -90 mapped to ROTATE_270 (clockwise). Swap the two cases so
rotating right actually rotates clockwise and rotating left rotates
counter-clockwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant