From 50ebd5467cbf80da6898bf307a8062f9cd300b6d Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Wed, 3 Apr 2019 16:28:15 +0200 Subject: [PATCH] state interpolation proof of concept --- src/mol-model/structure/structure/symmetry.ts | 5 +++++ src/mol-repr/structure/units-representation.ts | 1 - src/mol-repr/structure/units-visual.ts | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mol-model/structure/structure/symmetry.ts b/src/mol-model/structure/structure/symmetry.ts index 1b9170414..4f4cfe6f6 100644 --- a/src/mol-model/structure/structure/symmetry.ts +++ b/src/mol-model/structure/structure/symmetry.ts @@ -83,7 +83,12 @@ namespace StructureSymmetry { export function areTransformGroupsEquivalent(a: ReadonlyArray<Unit.SymmetryGroup>, b: ReadonlyArray<Unit.SymmetryGroup>) { if (a.length !== b.length) return false for (let i = 0, il = a.length; i < il; ++i) { + const au = a[i].units, bu = b[i].units; + if (au.length !== bu.length) return false; if (a[i].hashCode !== b[i].hashCode) return false + for (let j = 0, _j = au.length; j < _j; j++) { + if (au[j].conformation !== bu[j].conformation) return false; + } } return true } diff --git a/src/mol-repr/structure/units-representation.ts b/src/mol-repr/structure/units-representation.ts index b54a84c25..89e7adc7b 100644 --- a/src/mol-repr/structure/units-representation.ts +++ b/src/mol-repr/structure/units-representation.ts @@ -65,7 +65,6 @@ export function UnitsRepresentation<P extends UnitsParams>(label: string, ctx: R if (runtime.shouldUpdate) await runtime.update({ message: 'Creating or updating UnitsVisual', current: i, max: _groups.length }) } } else if (structure && !Structure.areEquivalent(structure, _structure)) { - // console.log(label, 'structure not equivalent') // Tries to re-use existing visuals for the groups of the new structure. // Creates additional visuals if needed, destroys left-over visuals. _groups = structure.unitSymmetryGroups; diff --git a/src/mol-repr/structure/units-visual.ts b/src/mol-repr/structure/units-visual.ts index 41b74b4d7..b657c4a7c 100644 --- a/src/mol-repr/structure/units-visual.ts +++ b/src/mol-repr/structure/units-visual.ts @@ -120,8 +120,12 @@ export function UnitsVisual<G extends Geometry, P extends UnitsParams & Geometry } // check if the conformation of unit.model has changed - if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0])) { + // if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0])) { + if (Unit.conformationId(newStructureGroup.group.units[0]) !== Unit.conformationId(currentStructureGroup.group.units[0]) + // TODO: this needs more attention + || newStructureGroup.group.units[0].conformation !== currentStructureGroup.group.units[0].conformation) { // console.log('new conformation') + updateState.updateTransform = true; updateState.createGeometry = true } -- GitLab