Skip to content

feat!: touchpad scroll for zoom (with Ctrl) and pan - #535

Merged
RobertMueller2 merged 1 commit into
Satty-org:mainfrom
robertwidfen:feat_touchpad_zoom_and__pan
Jun 14, 2026
Merged

RobertMueller2 merged 1 commit into
Satty-org:mainfrom
robertwidfen:feat_touchpad_zoom_and__pan

Conversation

@robertwidfen

Copy link
Copy Markdown
Collaborator

See issue #338.

Breaking change: Zooming with mouse now also requires Ctrl like in many other apps.

Comment thread src/sketch_board.rs
@RobertMueller2

RobertMueller2 commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

Ok, I definitely need more time to test this, might take a few days.

When using the touchpad, it does not feel the same like e.g. in a browser. I need to educate myself about touchpad gestures, though. But my gut feeling is that zooming should be a pinch move without ctrl? Can we figure that out from GTK?

Regarding regular mouse:

  • At first glance, I'm not sure I like the viewport clamping (other than ctrl modifier, which definitely makes sense). Before this PR, I can just move the view around freely, with this PR it feels quite limiting. EDIT: I assume the viewport clamping is a bit of a necessity for touchpad usage. I think we could make this configurable somehow, config sets which input types use viewport clamping and default would be to do it just for touchpad? Does that make sense?
  • Secondly, even if I'm zoomed in and CAN pan both vertically and horizontally, it feels sluggish and the motion frequently gets interrupted. I think I might accidentally trigger a wheel scroll event which interrupts the panning, need to confirm this.

@robertwidfen

Copy link
Copy Markdown
Collaborator Author

No hurry at all - take your time with the testing, and thank you for the feedback!

The clamping was intended to prevent the screenshot from moving completely "off-screen", which didn't feel too restrictive during my testing. Could you share a bit more about your workflow and why you'd prefer to move further? I'd love to avoid adding another configuration option if possible, as we already have quite a few. 🙃 Maybe I just remove the clamping code 😉, because less code is better and one can find the way back with the resize-to-regular or fit-to-page toolbar buttons.

It's also interesting that it feels sluggish for you - I haven't noticed any lag myself - see video below.

As for pinch-to-zoom: Chromium and other apps do support both pinch and Ctrl+Scroll. I rarely use pinch gestures on my laptop (mostly just on my phone), so I completely missed that, but likely people expect it.

satty-touchpad-support.mp4

@robertwidfen
robertwidfen force-pushed the feat_touchpad_zoom_and__pan branch from ff769df to 489db03 Compare June 11, 2026 20:06
Comment thread src/sketch_board.rs
if me.modifier.contains(ModifierType::CONTROL_MASK) {
let mut factor = APP_CONFIG.read().zoom_factor();
if me.is_touchpad {
factor = 1.0 + (factor - 1.0) / 2.0; // decrease a bit

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below

@robertwidfen

Copy link
Copy Markdown
Collaborator Author

It is now without clamping.

@RobertMueller2

Copy link
Copy Markdown
Member

No hurry at all - take your time with the testing, and thank you for the feedback!

The clamping was intended to prevent the screenshot from moving completely "off-screen", which didn't feel too restrictive during my testing. Could you share a bit more about your workflow and why you'd prefer to move further? I'd love to avoid adding another configuration option if possible, as we already have quite a few. 🙃 Maybe I just remove the clamping code 😉, because less code is better and one can find the way back with the resize-to-regular or fit-to-page toolbar buttons.

Well, maybe there wasn't enough time in the morning :)

I tried:

  • scroll vertical with mousewheel - feels natural
  • scroll horizontal with mousewheel - feels natural
  • scroll vertical with touchpad - feels natural
  • scroll horizontal with touchpad - feels natural

And I think these four actions actually did benefit from clamping. Sorry :)

However, and this is what I complained about this morning, when I'm using the middle mouse button to pan (and I might continue to do that) the clamping feels very limiting.

I think my preference would be to use clamping for panning via scrolling, and no clamping for panning via middle mouse button. Does that make sense?

  • scroll vertical with touchpad + control to zoom - feels usable, I'm not sure about the expected speed here

It's also interesting that it feels sluggish for you - I haven't noticed any lag myself - see video below.

The problem isn't lag. I think what happened (but I haven't confirmed via debugger) is this: I started to pan via middle mouse button and tried to move around, then accidentally triggered a scroll wheel event and the panning via middle mouse button stopped or at least got interrupted briefly. This is not what happens before the PR, although I'm sure I hit the scroll wheel just the same, the wheel is quite sensitive.

As for pinch-to-zoom: Chromium and other apps do support both pinch and Ctrl+Scroll. I rarely use pinch gestures on my laptop (mostly just on my phone), so I completely missed that, but likely people expect it.

Yeah, I think that could be a good addition. :)

- zoom with two finger pinch gesture
- zoom with two finger scroll and Ctrl modifier
- pan with two finger scroll

See issue Satty-org#338.

Breaking change: Zooming with mouse now also requires Ctrl like
in many other apps.
@robertwidfen
robertwidfen force-pushed the feat_touchpad_zoom_and__pan branch from 489db03 to ffce88d Compare June 12, 2026 23:04
@robertwidfen

Copy link
Copy Markdown
Collaborator Author

Now with pinch-to-zoom. 🤏

I dare to resurrect clamping - as discussed resize-to-regular or fit-to-page will bring you back if you got lost and it was irritating for you and likely is for others if you do not know the reason for the invisible bounds.

@RobertMueller2

Copy link
Copy Markdown
Member

Fair enough :) looks good to me now and pretty much ready to merge, should be fine once the inline comment is resolved.

@RobertMueller2

Copy link
Copy Markdown
Member

I'm going to merge this now. If anyone is bothered by the hardcoded value and inversion and/or the zoom factor modification, they can of course open an issue for these, and then we can talk about whether there's a better default, or this needs option(s).

@RobertMueller2
RobertMueller2 merged commit 7f6e489 into Satty-org:main Jun 14, 2026
3 checks passed
@robertwidfen
robertwidfen deleted the feat_touchpad_zoom_and__pan branch June 16, 2026 20:00
@robertwidfen

Copy link
Copy Markdown
Collaborator Author

If we might need config in the future it is at robertwidfen:feat/touchpad_zoom_pan_config

I will keep it on my stack for a while, but hope that we do not need it 😉

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.

2 participants