diff --git a/src/mol-gl/scene.ts b/src/mol-gl/scene.ts index e2c384baaeb41eff21a83fbedefc37d3d2ffbba9..a8d32ab433578eadd79980ce165fb49dc9864cfe 100644 --- a/src/mol-gl/scene.ts +++ b/src/mol-gl/scene.ts @@ -317,21 +317,21 @@ namespace Scene { get markerAverage() { if (markerAverageDirty) { markerAverage = calculateMarkerAverage(); - markerAverageDirty = true; + markerAverageDirty = false; } return markerAverage; }, get opacityAverage() { if (opacityAverageDirty) { opacityAverage = calculateOpacityAverage(); - opacityAverageDirty = true; + opacityAverageDirty = false; } return opacityAverage; }, get hasOpaque() { if (hasOpaqueDirty) { hasOpaque = calculateHasOpaque(); - hasOpaqueDirty = true; + hasOpaqueDirty = false; } return hasOpaque; }, diff --git a/src/mol-math/geometry/symmetry-operator.ts b/src/mol-math/geometry/symmetry-operator.ts index 0150e396e499a838944b2841b605478095f94362..279478b5e2f4bcc20aa5a2aeef4d221fbaa3e0af 100644 --- a/src/mol-math/geometry/symmetry-operator.ts +++ b/src/mol-math/geometry/symmetry-operator.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2023 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> @@ -177,15 +177,15 @@ namespace SymmetryOperator { export interface Coordinates { x: ArrayLike<number>, y: ArrayLike<number>, z: ArrayLike<number> } - export function createMapping<T extends number>(operator: SymmetryOperator, coords: Coordinates, radius: ((index: T) => number)): ArrayMapping<T> { + function _createMapping<T extends number>(operator: SymmetryOperator, coords: Coordinates, radius: ((index: T) => number)): ArrayMapping<T> { const invariantPosition = createCoordinateMapper(SymmetryOperator.Default, coords); const position = operator.isIdentity ? invariantPosition : createCoordinateMapper(operator, coords); const { x, y, z } = createProjections(operator, coords); return { operator, coordinates: coords, invariantPosition, position, x, y, z, r: radius }; } - export function createMappingZeroRadius<T extends number>(operator: SymmetryOperator, coords: Coordinates): ArrayMapping<T> { - return createMapping(operator, coords, _zeroRadius); + export function createMapping<T extends number>(operator: SymmetryOperator, coords: Coordinates, radius: ((index: T) => number) = _zeroRadius) { + return _createMapping(operator, coords, radius); } export function createCoordinateMapper<T extends number>(t: SymmetryOperator, coords: Coordinates): CoordinateMapper<T> { diff --git a/src/mol-model/structure/structure/unit.ts b/src/mol-model/structure/structure/unit.ts index b879ed05ef1ba70f3cd6ea802531dda5507c4f3c..6f6d1a814f71bd7dd1f5933d68c521d399c05ab6 100644 --- a/src/mol-model/structure/structure/unit.ts +++ b/src/mol-model/structure/structure/unit.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-2023 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> @@ -46,7 +46,7 @@ namespace Unit { export function create<K extends Kind>(id: number, invariantId: number, chainGroupId: number, traits: Traits, kind: Kind, model: Model, operator: SymmetryOperator, elements: StructureElement.Set, props?: K extends Kind.Atomic ? AtomicProperties : CoarseProperties): Unit { switch (kind) { - case Kind.Atomic: return new Atomic(id, invariantId, chainGroupId, traits, model, elements, SymmetryOperator.createMappingZeroRadius(operator, model.atomicConformation), props ?? AtomicProperties()); + case Kind.Atomic: return new Atomic(id, invariantId, chainGroupId, traits, model, elements, SymmetryOperator.createMapping(operator, model.atomicConformation), props ?? AtomicProperties()); case Kind.Spheres: return createCoarse(id, invariantId, chainGroupId, traits, model, Kind.Spheres, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.spheres, getSphereRadiusFunc(model)), props ?? CoarseProperties()); case Kind.Gaussians: return createCoarse(id, invariantId, chainGroupId, traits, model, Kind.Gaussians, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.gaussians, getGaussianRadiusFunc(model)), props ?? CoarseProperties()); } @@ -247,7 +247,7 @@ namespace Unit { } const conformation = (this.model.atomicConformation !== model.atomicConformation || operator !== this.conformation.operator) - ? SymmetryOperator.createMappingZeroRadius(operator, model.atomicConformation) + ? SymmetryOperator.createMapping(operator, model.atomicConformation) : this.conformation; return new Atomic(this.id, this.invariantId, this.chainGroupId, this.traits, model, this.elements, conformation, props); } @@ -408,7 +408,7 @@ namespace Unit { } const conformation = coarseConformation !== modelCoarseConformation - ? SymmetryOperator.createMappingZeroRadius(this.conformation.operator, modelCoarseConformation) + ? SymmetryOperator.createMapping(this.conformation.operator, modelCoarseConformation) : this.conformation; return new Coarse(this.id, this.invariantId, this.chainGroupId, this.traits, model, this.kind, this.elements, conformation, props) as Unit.Spheres | Unit.Gaussians; // TODO get rid of casting }