Repository navigation
feat(web): add a trackpad mode for touch screens - #115
Merged
Merged
Conversation
DarrenBaldwin07
added a commit
that referenced
this pull request
Nov 19, 2026
## What Bumps voxl from 0.3.5 to 0.4.0 in `Cargo.toml`, `Cargo.lock` and `default.nix`. Once this merges, pushing the `v0.4.0` tag on the merge commit publishes the crate to crates.io and creates the GitHub release, with generated notes and the crate attached (`release.yml`). Changes since the `v0.3.5` tag: - perf: build x264 with patches that skip unchanged macroblocks (#116) - feat(web): add a trackpad mode for touch screens (#115) - build: declare rust-version 1.86, the Rust the Linux CI job builds with (#107) The `v0.3.5` tag points at #99 (the optional `pulseaudio` feature), so that change is already in 0.3.5 and isn't repeated here. ## Testing - `cargo metadata --locked` passes, so `Cargo.lock` matches `Cargo.toml`. <br /> > Want tembo to make any changes? Add a comment with `@tembo` and i'll get back to work! <a href="https://app.tembo.io/sessions/75ad8969-8072-458a-973b-b4f3cec3bbac"><picture><source media="(prefers-color-scheme: dark)" srcset="https://internal.tembo.io/static/view/tembo-dark.png?v=3"><source media="(prefers-color-scheme: light)" srcset="https://internal.tembo.io/static/view/tembo-light.png?v=3"><img alt="View on Tembo" src="https://internal.tembo.io/static/view/tembo-light.png?v=3" width="134" height="28"></picture></a> <a href="https://app.tembo.io/reviews/redirect?sessionId=75ad8969-8072-458a-973b-b4f3cec3bbac"><picture><source media="(prefers-color-scheme: dark)" srcset="https://internal.tembo.io/public/tembo-button/review?theme=dark&v=3"><source media="(prefers-color-scheme: light)" srcset="https://internal.tembo.io/public/tembo-button/review?theme=light&v=3"><img alt="Review in Tembo" src="https://internal.tembo.io/public/tembo-button/review?theme=light&v=3" width="145" height="28"></picture></a> <a href="https://app.tembo.io/settings/models"><picture><source media="(prefers-color-scheme: dark)" srcset="https://internal.tembo.io/public/agent-button/claudeCode:claude-opus-5-5:xhigh?theme=dark&v=12"><source media="(prefers-color-scheme: light)" srcset="https://internal.tembo.io/public/agent-button/claudeCode:claude-opus-5-5:xhigh?theme=light&v=12"><img alt="View Agent Settings" src="https://internal.tembo.io/public/agent-button/claudeCode:claude-opus-5-5:xhigh?theme=light&v=12" height="28"></picture></a> <a href="https://tembo-io.slack.com/archives/C08S9PXF1KJ/p1795122498696389"><picture><source media="(prefers-color-scheme: dark)" srcset="https://internal.tembo.io/public/vendor-button/slack?theme=dark&v=2"><source media="(prefers-color-scheme: light)" srcset="https://internal.tembo.io/public/vendor-button/slack?theme=light&v=2"><img alt="View on slack" src="https://internal.tembo.io/public/vendor-button/slack?theme=light&v=2" height="28"></picture></a>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a trackpad mode for phones and tablets. In the default touch mode, the desktop pointer jumps to wherever the finger lands. In trackpad mode the screen works like a laptop trackpad: the finger moves a cursor relative to where it is, and clicks land on the cursor, not under the finger. That makes small targets usable on a phone, where a fingertip covers several desktop pixels.
A new toolbar button switches between the two modes. It only appears on touch devices and is hidden for read-only viewers. The browser remembers the choice in
localStorage.Left: trackpad mode on (390×844 phone, 1600×1000 desktop), with the button highlighted and the desktop's cursor drawn at the pointer. Right: pinched in to 4.4×, where the cursor keeps its normal size.
Gestures (trackpad mode)
1 + 0.8 × speed in CSS px/ms).Touch mode, mouse, and pen input are unchanged.
How
touch.ts: trackpad mode is a flag on the existing gesture state machine, so the two-finger scroll/pinch logic is shared. It adds amovestate (relative cursor movement) and changes what tap, long press, and a two-finger tap do.pointer.ts: keeps the pointer's desktop position, using fractions while gliding so slow moves don't lose precision. AddsmoveBy(relative move, plus the zoomed view following the cursor) andsetTrackpad. A new#padelement behind the desktop covers the window in trackpad mode. A touch that lands on it captures the pointer to the surface, so the rest of the gesture goes through the usual handlers.cursor.ts: touch screens show no CSS cursor, so the cursor image the server sends is also drawn on#pointer, positioned in percent of the surface.#pointeris hidden when the desktop hides its cursor. It also stays hidden when the server sends no cursor images, as with macOS--show-cursor, where the cursor is already in the video.zoom.ts: sets--zoomon the surface, and#pointerscales back by1 / --zoomaround its hotspot to keep its size.toolbar.ts/index.html: the toggle button (shown on touch devices, hidden when read-only), its persistence, and the styles.Testing
npm run check(oxfmt, oxlint, tsc) passes.isMobile,hasTouch). I drove multi-touch with CDPInput.dispatchTouchEventagainst a page on the desktop that records the pointer position, clicks, double-clicks, context menus, and a draggable box:aria-pressed="true", the cursor appeared, and the mode survived a reload.dblclick.contextmenuat the cursor. Two-finger swipe: no clicks or context menus.