Skip to content

refactor: canvas widget adjustments - #1719

Merged
flxzt merged 9 commits into
flxzt:mainfrom
Kneemund:refactor/canvas-widget-adjustments
May 1, 2026
Merged

refactor: canvas widget adjustments#1719
flxzt merged 9 commits into
flxzt:mainfrom
Kneemund:refactor/canvas-widget-adjustments

Conversation

@Kneemund

@Kneemund Kneemund commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

  • Transforms the camera offset into an absolute range for configuring the adjustments of the canvas widget.
  • Updates camera offset as soon as adjustments emit a value changed signal, instead of during layout (re-)allocation.
  • Autoexpands the canvas when an adjustment changes (like all other gestures/actions), making the autoexpand on edge overshoot redundant. As a preparation for feat: rotate canvas #1712, we cannot rely on edge overshoot callbacks, because when the document is rotated, we have to expand it before reaching the ScrolledWindow edge.
  • Because of the above, we hit a GTK bug related to kinetic scrolling. 53af354 works around this bug by temporarily disabling kinetic scrolling when the document is about to be expanded.

TODO

@Kneemund Kneemund mentioned this pull request Apr 3, 2026
4 tasks
@Kneemund
Kneemund marked this pull request as draft April 3, 2026 00:46
@Kneemund
Kneemund marked this pull request as ready for review April 3, 2026 01:37
@Kneemund
Kneemund marked this pull request as draft April 3, 2026 15:27
@Kneemund
Kneemund marked this pull request as ready for review April 4, 2026 19:32
@Kneemund
Kneemund force-pushed the refactor/canvas-widget-adjustments branch 2 times, most recently from a1aa124 to 71664b5 Compare April 4, 2026 22:32
@Kneemund
Kneemund force-pushed the refactor/canvas-widget-adjustments branch from 118dfb9 to 86077d9 Compare April 14, 2026 22:10
@Kneemund
Kneemund force-pushed the refactor/canvas-widget-adjustments branch from 86077d9 to d0de4ab Compare April 14, 2026 22:50
Comment thread crates/rnote-ui/src/canvas/mod.rs Outdated
@flxzt

flxzt commented Apr 25, 2026

Copy link
Copy Markdown
Owner

Looks good, functionally it fixes the outlined issues.
I also like that it fixes this by moving the overshoot logic into the engine,
not relying on GTK's widget overshoot mechanic anymore. This is a cleaner approach.
It also brings down the complexity of this logic a bit (- the needed workarounds) by improving function names, introducing some helpers like surface_to_adjustment and add comments. Which is a big step in the right direction but complexity is still high which I'll need to address in a code cleanup in the future to ensure future maintainability.

@Kneemund

Copy link
Copy Markdown
Collaborator Author

I agree that this needs to be cleaned up in the future. Especially the surface <-> adjustment conversion should be more hidden/abstracted away, but I couldn't really find a good way to do that within the current code without re-calculating the surface bounds all the time.

@flxzt
flxzt merged commit 02286b1 into flxzt:main May 1, 2026
2 checks passed
@Kneemund
Kneemund deleted the refactor/canvas-widget-adjustments branch May 18, 2026 10:57
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.

[Regression] Pinch-to-zoom broken on touchscreen after v0.14.1 Canvas doesn't stay centered in page after zoom Zoom in: canvas jumps around a bit

2 participants