Skip to content

fix(timeline): unify dashed border stripe coordinates to screen pixels - #949

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-oxtltpxlkrzp
Sep 3, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-oxtltpxlkrzp

Conversation

@kyasbal

@kyasbal kyasbal commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Fixes a unit inconsistency in revision dashed border rendering where milliseconds (time) were directly added to screen pixels (space).

Root Cause

In revision.color-fragment.glsl, borderStripePattern previously computed:

float patternVal = leftEdgeTimeMS + posAlongBorder;
float stripeVal = mod(patternVal, pitch);
  • leftEdgeTimeMS was passed from the vertex shader in milliseconds (time difference from vs.leftEdgeTime).
  • posAlongBorder was computed in screen pixels (uv * revisionScreenSize).
  • When zooming, vs.pixelsPerMs changes, causing the phase offset leftEdgeTimeMS mod pitch to spin violently relative to zoom level. This produced severe stroboscopic flickering and moire artifacts across rows.
  • Furthermore, on vertical edges, adding horizontal milliseconds to the vertical pixel coordinate caused box corners to misalign or clip.

Solution

  1. revision.vertex.glsl: Replaced leftEdgeTimeMS with revisionClippedOffsetPx (screen pixel offset for revisions that start outside the viewport and are clamped by minTime). For unclipped revisions, this is 0.0.
  2. revision.color-fragment.glsl: Replaced leftEdgeTimeMS + posAlongBorder with mix(revisionClippedOffsetPx + revisionRelativeUV.x, revisionRelativeUV.y, isVerticalEdge). Dashes now run along pure screen pixel units for both horizontal and vertical edges.
  3. revision.hittest-fragment.glsl: Updated the unused input variable declaration to match the vertex shader output.

Test Plan

  • npx ng test --include src/app/timeline/components/canvas/glsl-function-tester.spec.ts --browsers ChromeHeadlessNoSandbox --watch=false (10/10 passed)
  • make test-web (1088/1088 passed)
  • make pre-commit (all linters and formatters passed cleanly)
Previously, the fragment shader added leftEdgeTimeMS (milliseconds) directly
to posAlongBorder (pixels) to compute the dashed border pattern for revisions.
Because of this dimensional mismatch, zooming in or out caused the phase of
the pattern to spin rapidly relative to pixelsPerMs, producing intense
stroboscopic flickering and moire artifacts across rows.

Replace leftEdgeTimeMS with revisionClippedOffsetPx in pixels, and compute
posAlongBorder using screen pixel coordinates for both horizontal and vertical
borders.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the revision border stripe pattern calculation in the GLSL shaders, replacing the timestamp-based leftEdgeTimeMS with a pixel-offset-based revisionClippedOffsetPx. Feedback points out a potential precision loss issue in revision.vertex.glsl when a revision starts far to the left of the viewport, which can cause rendering artifacts. Applying a modulo operation with the border stripe pitch in the vertex shader is recommended to keep the offset value small and maintain float precision.

Comment thread web/src/assets/revision.vertex.glsl Resolved
@kyasbal kyasbal added the type:bug Something isn't working as expected label Sep 3, 2026
@kyasbal
kyasbal merged commit c437877 into GoogleCloudPlatform:main Sep 3, 2026
17 checks passed
@kyasbal
kyasbal deleted the push-oxtltpxlkrzp branch September 3, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Something isn't working as expected

1 participant