Skip to content

Fix viewer gimbal lock and add ligand-aware chain coloring - #1

Merged
murrellb merged 1 commit into
mainfrom
fix/viewer-trackball-chain-colors
Oct 1, 2026
Merged

murrellb merged 1 commit into
mainfrom
fix/viewer-trackball-chain-colors

Conversation

@murrellb

@murrellb murrellb commented Oct 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace fixed-up OrbitControls with Three.js TrackballControls for unrestricted rotation through both poles. Preserve modified left-drag panning, right-drag pan, wheel zoom, and touch controls.
  • Restore the default up vector and recreate/dispose controls on reset to clear pending rotation, zoom, and pan inertia. Refresh pointer bounds on resize and disable global A/S/D mouse-mode shortcuts so text editing does not interfere.
  • Extend the existing chain-color mode with Color by → Chain and a checked-by-default Keep ligand colors by element setting. Unchecking it colors ligand atoms and bonds by chain, including ligand-only chains and role-zero molecules.
  • Preserve protein palette ordering, compose active-ligand highlighting with either color mode, retain color preferences across sample changes, and leave the reference overlay unchanged.
  • Add regression tests, a self-contained Playwright viewer harness, and a read-only GitHub Actions workflow.

This applies the supplied viewer-trackball-chain-colors.patch unchanged. All ten resulting file blob hashes were verified against the uploaded patch; the base is 0a2b86a13dc5db5c7ba472ea6680fc294eb596c1.

Validation completed

  • node --test tests/viewer-color-controls.mjs: 4 passed, 0 failed.
  • node --check for every changed/new JavaScript and MJS file: passed.
  • Clean patch application against the original upstream file hashes: passed.
  • git diff --check: passed.

Validation pending

The nine Three.js geometry/color tests, Playwright camera/UI/touch checks, existing preparation suite, and production build were not run locally. The execution environment has no installed Three.js, Playwright, or Vite dependencies and cannot resolve external hosts to download them.

The new Viewer tests workflow is configured to install dependencies and Chromium, then run:

npm run test:viewer
npm run test:viewer-browser
npm run test:prep
npm run build

Manual review

  1. Tumble through both poles; confirm horizontal rotation still works at either world-Y pole.
  2. Check pan/zoom, one-finger rotation, two-finger pinch/pan, reset during damping, and resize.
  3. Select Color by → Chain and toggle Keep ligand colors by element.
  4. Select/deselect ligands and protein residues, switch color modes, and load another sample or campaign result to check highlighting and retained settings.

Use TrackballControls for unrestricted rotation and add an element-color
preservation setting for ligands in chain-color mode. Include regression
tests and a read-only viewer CI workflow.
@murrellb
murrellb merged commit a217189 into main Oct 1, 2026
1 check passed
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