From fb4d8025672a3e8af57e1d0239ef65c059caeee3 Mon Sep 17 00:00:00 2001 From: Ben Murrell Date: Thu, 1 Oct 2026 10:32:20 +0200 Subject: [PATCH] Fix viewer pole locking and add ligand-aware chain coloring 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. --- .github/workflows/viewer-tests.yml | 44 +++++++ index.html | 6 +- package.json | 2 + src/main.js | 18 +-- src/viewer-color-controls.js | 20 +++ src/viewer.js | 90 ++++++++++++-- tests/viewer-color-controls.mjs | 70 +++++++++++ tests/viewer-fixture.mjs | 17 +++ tests/viewer.mjs | 150 +++++++++++++++++++++++ tests/viewer_browser.mjs | 189 +++++++++++++++++++++++++++++ 10 files changed, 578 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/viewer-tests.yml create mode 100644 src/viewer-color-controls.js create mode 100644 tests/viewer-color-controls.mjs create mode 100644 tests/viewer-fixture.mjs create mode 100644 tests/viewer.mjs create mode 100644 tests/viewer_browser.mjs diff --git a/.github/workflows/viewer-tests.yml b/.github/workflows/viewer-tests.yml new file mode 100644 index 0000000..b4f539a --- /dev/null +++ b/.github/workflows/viewer-tests.yml @@ -0,0 +1,44 @@ +name: Viewer tests + +on: + pull_request: + paths: + - 'src/**' + - 'tests/**' + - 'index.html' + - 'package*.json' + - 'vendor/**' + - 'tools/prepare_mpnn_runtime.mjs' + - '.github/workflows/viewer-tests.yml' + push: + branches: [main] + paths: + - 'src/**' + - 'tests/**' + - 'index.html' + - 'package*.json' + - 'vendor/**' + - 'tools/prepare_mpnn_runtime.mjs' + - '.github/workflows/viewer-tests.yml' + +permissions: + contents: read + +jobs: + viewer: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npm run test:viewer + - run: npx playwright install --with-deps chromium + - run: npm run test:viewer-browser + - run: npm run test:prep + - run: npm run build diff --git a/index.html b/index.html index b563ec3..4ab84dd 100644 --- a/index.html +++ b/index.html @@ -117,7 +117,11 @@

Interactive docking

- + +