Skip to content

feat: rotate canvas#1712

Draft
Kneemund wants to merge 14 commits intoflxzt:mainfrom
Kneemund:feature/rotate-canvas
Draft

feat: rotate canvas#1712
Kneemund wants to merge 14 commits intoflxzt:mainfrom
Kneemund:feature/rotate-canvas

Conversation

@Kneemund
Copy link
Copy Markdown
Collaborator

@Kneemund Kneemund commented Mar 29, 2026

Adds support for rotating the canvas.

canvas_rotation.mp4

TODO

  • UI element that indicates current rotation and can be used for modifying it.
  • Better touch UX - it is very easy to accidentally rotate the canvas while zooming. GIMP seems to have solved this by making zoom and rotation exclusive (https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/597).
  • Document and adjust key bindings & gestures.
  • Selecting while rotated feels weird.

Known Issues

In a fixed layout, rotating by more than 45° (e.g. 180°) and scrolling to the right or bottom edge makes the camera jump back into the center. I don't know why this is happening. Fixed by #1719.

@Kneemund Kneemund force-pushed the feature/rotate-canvas branch from fef733e to 0daf8fd Compare April 1, 2026 21:14
@flxzt
Copy link
Copy Markdown
Owner

flxzt commented Apr 2, 2026

Nice, that's a great addition!

improvements I'd add to the list:

  • selecting while rotated feels very weird. I would expect that the selection always has the non-rotated reference coordinate system. It's tricky to get the details how it should behave once rotated, but maybe there could be a recalculation of the selection rectangle once the rotation is finished.
  • When the rotation is close to 0° (maybe also +-90° and 180°), it would be nice to have a small band where it snaps to these angles.

@Kneemund
Copy link
Copy Markdown
Collaborator Author

Kneemund commented Apr 2, 2026

selecting while rotated feels very weird. I would expect that the selection always has the non-rotated reference coordinate system. It's tricky to get the details how it should behave once rotated, but maybe there could be a recalculation of the selection rectangle once the rotation is finished.

I'm not sure about this. I feel like the other end of the spectrum could also work, i.e. make the rotation rectangle an oriented bounding box which has the same rotation as the camera at the time of its creation.

When the rotation is close to 0° (maybe also +-90° and 180°), it would be nice to have a small band where it snaps to these numbers.

This is already implemented, there are areas of 2° that snap the rotation into multiples of 45°. Maybe 2° is too small?


Also, do you have any ideas for improving the touch gesture? I feel like making rotation and zooming exclusive (like GIMP) is quite restrictive and makes it a lot less "fun" to use, at least for me. I'll probably try adding an activation threshold/hysteresis for rotation and test if that works.

Kneemund added 2 commits April 3, 2026 01:54
…ustments

fixes "gtk_adjustment_configure: assertion 'lower + page_size <= upper' failed"
@Kneemund Kneemund force-pushed the feature/rotate-canvas branch from 0daf8fd to 69ec9e2 Compare April 3, 2026 00:04
@Kneemund Kneemund force-pushed the feature/rotate-canvas branch 3 times, most recently from 1b4e279 to 84f0d97 Compare April 3, 2026 11:50
@Kneemund Kneemund force-pushed the feature/rotate-canvas branch from 84f0d97 to 072a065 Compare April 3, 2026 13:56
@Kneemund Kneemund force-pushed the feature/rotate-canvas branch from 072a065 to 4e91891 Compare April 4, 2026 19:51
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.

Add canvas rotation, not only zoom and move.

2 participants