Implement trajectory indicator#4
Merged
Roy-Kid merged 4 commits intoJun 11, 2025
Merged
Conversation
Roy-Kid
added a commit
that referenced
this pull request
Jun 11, 2025
* [feat] add edite mode * Add edit mode and tests * Refine edit mode and rename manager * Add magnetic bond snapping in edit mode * Refine view mode menu (#3) * Implement trajectory indicator (#4) * Add trajectory view and frame indicator * Use Tweakpane slider for frame indicator * Refine frame indicator * Refine frame indicator layout * Implement edit mode menu (#5) * Add edit mode menu with periodic table plugin * Show menu only when no mesh is picked * Fix periodic table plugin registration and set menu title * Fix tweakpane plugin registration * fix plugin compatibility * Remove periodic table plugin and use list * Implement multi-order bonds * Fix multi-bond offsets and click behavior * feat: enable select mode (#7)
Roy-Kid
added a commit
that referenced
this pull request
Apr 29, 2026
…FrameDataSource Phase 1, task #1 of multi-data-source-pipeline spec. DataSourceModifier becomes an abstract base. Two concrete subclasses: - TrajectoryDataSource(trajectory): owns a multi-frame Trajectory. frameCount = trajectory.length; getFrame(i) = trajectory.frame(i) (async). preload(i) caches the i-th frame for sync access during pipeline phase A. dispose() forwards to trajectory.dispose(). - FrameDataSource(frame): owns a single Frame. frameCount = 1; getFrame(_) returns the same frame regardless of index — this is the static-topology broadcast mechanism. preload() is a no-op; cachedFrame is always available. dispose() calls frame.free(). Both retain the existing identity apply() semantics (block injection will move to ModifierPipeline.compute phase A in task #2). Visibility flags showAtoms/showBonds/showBox are kept on the abstract base @deprecated for the existing UI panel — will be removed in phase 3 when per-DS Draw modifier toggles take over. DataSourceModifier no longer registers itself in ModifierRegistry — DSs enter the pipeline only via file ingress (`io/loadFileContent`, `io/loadFileStream`) or RPC. Users cannot add a bare DS from the modifier picker. Existing call sites that constructed `new DataSourceModifier()` now construct `new FrameDataSource(...)` as a transitionary placeholder; tasks #4–#5 replace those with proper addDataSource flows. All 445 core tests pass. Core typecheck clean.
Roy-Kid
added a commit
that referenced
this pull request
Apr 29, 2026
Phase 1, task #2 of multi-data-source-pipeline spec. ModifierPipeline.compute() drops its FrameSource argument and now runs in two phases: Phase A — DS merge: walk every enabled DataSourceModifier in array order, await preload(frameIndex) in parallel, then insertBlock each DS's contributedBlocks (or the default {atoms, bonds} fallback) into a fresh working Frame. Last-wins on block-name and simbox conflict. molrs Block::clone is an Arc::clone (refcount bump), so this merge is O(num_columns) per DS. Phase B — modifier apply: walk every enabled non-DS modifier, preserving the existing parent/selection-resolution and validation logic. DSs are skipped (their identity apply() is a no-op). The new signature accepts an optional `overrideFrame` that short-circuits phase A, used as a transitional bridge by `MolvisApp.applyPipeline({ sourceFrame })` until tasks #3–#4 retire the legacy "pass a frame to the pipeline" path. Removed: - `FrameSource` interface (pipeline.ts) - `ArrayFrameSource` / `SingleFrameSource` / `AsyncFrameSource` / `ZarrFrameSource` classes (commands/sources.ts deleted) - `ZarrReaderLike` type (no consumer left) - Dead `MolvisApp.computeFrame` method (no callers) - Re-exports through commands/index.ts and core/src/index.ts Updated: - `dag_pipeline.test.ts` switched its inline FrameSource helper to the override-bridge form. State-transition tests for phase A live in task #7. All 445 core tests pass. Core typecheck clean.
Roy-Kid
added a commit
that referenced
this pull request
Apr 29, 2026
Phase 1, task #6 of multi-data-source-pipeline spec. `loadFileContent` and `loadFileStream` gain an optional `mode` parameter (`"replace" | "append"`, default `"replace"` to preserve existing UX). In append mode they apply the spec's load decision tree: - Single-frame file (`N_file === 1`) → wrap as `FrameDataSource` and broadcast across whatever trajectory length the pipeline already has (or stay at 1 if there's no trajectory yet). - Multi-frame file matching the existing trajectory length (or no existing trajectory) → wrap as `TrajectoryDataSource` so phase A index-aligns frame-by-frame. - Frame-count mismatch → throw `Cannot append "<filename>": file has N frame(s); existing trajectory has M. File must be single-frame (topology) or match existing frame count.` A new internal helper `appendTrajectoryAsDataSource` runs the decision tree and adds an atom-count consistency check: if both the existing system and the new file contribute an `atoms` block, their atom counts must match (otherwise downstream bonds/selection indices would dangle). Then forwards to `MolvisApp.addDataSource`, which performs the redundant frame-count check and runs auto-attach. Trajectory disposal on error stays correct: append mode disposes the trajectory if validation throws, so failed loads don't leak WASM. Replace mode is unchanged — keeps using `ensureDataSource` + `setTrajectory`, which after task #3+#4 also routes through a TrajectoryDataSource transparently. Page UI stays single-DS until the phase-3 "Add Data Source" button passes `mode: "append"`. All 445 core tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
npm run testhttps://chatgpt.com/codex/tasks/task_e_6849653e8ce08324a430cb3b6ea6f7be