Skip to content

fix(umap): render landmark triangles with scattergl to fix touch-pan desync#295

Merged
lstein merged 1 commit into
masterfrom
lstein/fix/umap-touch-pan-triangle-trace
Jun 4, 2026
Merged

fix(umap): render landmark triangles with scattergl to fix touch-pan desync#295
lstein merged 1 commit into
masterfrom
lstein/fix/umap-touch-pan-triangle-trace

Conversation

@lstein
Copy link
Copy Markdown
Owner

@lstein lstein commented Jun 4, 2026

Problem

On tablets, touching the UMAP plot and immediately dragging to pan made only the colored landmark triangles move with the finger while the dots and the rest of the plot stayed frozen. Touching, pausing briefly, then dragging worked fine.

Cause

The main point traces use scattergl (WebGL) while the landmark triangle trace used scatter (SVG). During a touch pan, Plotly translates the SVG layer immediately but only repaints the WebGL scene once the gesture settles. So a touch-and-immediately-drag translated the SVG layer (the triangles — the only visible SVG element on the plot) while the WebGL scene (the dots) stayed put until release.

Fix

Switch the landmarkTrace to type: "scattergl" so the triangles live in the same WebGL pipeline as the points and freeze-and-snap together with the rest of the plot.

The invisible clickableTrace is intentionally left as SVG scatter: its hit squares can be up to 256px and would risk GL point-size clamping, and being invisible its drag-time position is never seen. Landmark hit-testing (umap-helpers.js) is pure x/y geometry and the trace is located by name === "Landmarks", so neither depends on the renderer type.

Testing

  • Verified on a tablet: the touch-and-immediately-drag pan no longer desyncs.
  • npm test — 343/343 frontend tests pass; ESLint and Prettier clean.

🤖 Generated with Claude Code

…desync

The main UMAP point traces use scattergl (WebGL) while the landmark
triangle trace used scatter (SVG). During a touch pan, Plotly translates
the SVG layer immediately but only repaints the WebGL scene once the
gesture settles. On tablets, a touch-and-immediately-drag therefore made
the triangles slide alone on the SVG layer while the dots stayed frozen.

Switching the landmark trace to scattergl keeps it in the same WebGL
pipeline as the points, so the triangles freeze-and-snap together with
the rest of the plot. The invisible click-target trace stays SVG to
avoid GL point-size clamping on its large (up to 256px) hit squares.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lstein lstein merged commit 8bda412 into master Jun 4, 2026
10 checks passed
@lstein lstein deleted the lstein/fix/umap-touch-pan-triangle-trace branch June 4, 2026 11:32
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