Merge branch 'master' of https://github.com/molstar/molstar into proc-anim

This commit is contained in:
Alexander Rose
2026-04-01 14:22:50 -07:00
3 changed files with 15 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ Note that since we don't clearly distinguish between a public and private interf
- MolViewSpec
- Add `VolumeStreamingExtension` (`molstar_volume_streaming` custom property)
- Fix focusing empty selections
- Avoid re-calculating static model properties for trajectories
## [v5.7.0] - 2026-02-28
- Text label improvements

View File

@@ -80,10 +80,18 @@ export interface Model extends Readonly<{
customProperties: CustomProperties,
/**
* Properties independent of coordinates or other dynamic aspects.
*
* Not to be accessed directly, each custom property descriptor
* defines property accessors that use this field to store the data.
*/
_staticPropertyData: { [name: string]: any },
/**
* Properties that depend on coordinates or other dynamic aspects.
*
* Not to be accessed directly, each custom property descriptor
* defines property accessors that use this field to store the data.
*/
_dynamicPropertyData: { [name: string]: any },
coarseHierarchy: CoarseHierarchy,
@@ -113,9 +121,6 @@ export namespace Model {
modelNum: i,
atomicConformation: getAtomicConformationFromFrame(model, f),
// TODO: add support for supplying sphere and gaussian coordinates in addition to atomic coordinates?
// coarseConformation: coarse.conformation,
customProperties: new CustomProperties(),
_staticPropertyData: Object.create(null),
_dynamicPropertyData: Object.create(null)
};
@@ -188,14 +193,14 @@ export namespace Model {
const AtomicRadiiProp = '__AtomicRadii__';
/** Get array of atomic radii for all atoms in the model (cached). */
export function getAtomicRadii(model: Model): Float32Array {
if (model._dynamicPropertyData[AtomicRadiiProp]) return model._dynamicPropertyData[AtomicRadiiProp];
if (model._staticPropertyData[AtomicRadiiProp]) return model._staticPropertyData[AtomicRadiiProp];
const nAtoms = model.atomicHierarchy.atoms._rowCount;
const type_symbol = model.atomicHierarchy.atoms.type_symbol.value;
const radii = new Float32Array(nAtoms);
for (let i = 0; i < nAtoms; i++) {
radii[i] = VdwRadius(type_symbol(i));
}
model._dynamicPropertyData[AtomicRadiiProp] = radii;
model._staticPropertyData[AtomicRadiiProp] = radii;
return radii;
}

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017-2025 mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2017-2026 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
@@ -284,9 +284,10 @@ namespace Unit {
get boundary() {
if (this.props.boundary) return this.props.boundary;
const fast = Traits.is(this.traits, Trait.FastBoundary);
const { x, y, z } = this.model.atomicConformation;
const radius = Model.getAtomicRadii(this.model);
this.props.boundary = Traits.is(this.traits, Trait.FastBoundary)
const radius = fast ? undefined : Model.getAtomicRadii(this.model);
this.props.boundary = fast
? getFastBoundary({ x, y, z, radius, indices: this.elements })
: getBoundary({ x, y, z, radius, indices: this.elements });
return this.props.boundary;