Skip to content

fix: the canvas glides on whole device pixels - #40

Merged
ba2slk merged 1 commit into
mainfrom
fix/canvas-device-pixel-snap
Aug 18, 2026
Merged

fix: the canvas glides on whole device pixels#40
ba2slk merged 1 commit into
mainfrom
fix/canvas-device-pixel-snap

Conversation

@ba2slk

@ba2slk ba2slk commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Thin strokes shimmered while the canvas glided and could stay soft after it stopped. The track moves by translateX, and the offset was rounded to whole CSS pixels; at a fractional display scale such as 1.67× a whole CSS pixel is not a whole device pixel, so two frames in three landed the composited layers between device pixels and the compositor resampled them. The offset is now rounded in device pixels (snapToDevicePixels, read from devicePixelRatio each frame), which at 1× and 2× is exactly what it was. Screencast of the same six-notch fling, variance of the Laplacian over the pane area: moving frames averaged 128 before and 143 after; the frame at rest went from 127 to 148. The self-check reads the fractional track offset accordingly.

Generated with Claude Code

@ba2slk
ba2slk merged commit 4ff5c6b into main Aug 18, 2026
2 checks passed
@ba2slk
ba2slk deleted the fix/canvas-device-pixel-snap branch August 18, 2026 08:13
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