Browse Source

Merge branch 'master' of https://github.com/molstar/molstar

Alexander Rose 4 years ago
parent
commit
c376ddfc9d

+ 4 - 1
src/mol-plugin-state/manager/structure/focus.ts

@@ -124,7 +124,10 @@ export class StructureFocusManager extends StatefulPluginComponent<StructureFocu
     }
 
     setSnapshot(snapshot: StructureFocusSnapshot) {
-        if (!snapshot.current) return;
+        if (!snapshot.current) {
+            this.clear();
+            return;
+        }
 
         const { label, ref, bundle, category } = snapshot.current;
         const structure = this.plugin.state.data.select(StateSelection.Generators.byRef(ref))[0]?.obj?.data as Structure;

+ 1 - 1
src/mol-plugin-state/manager/structure/selection.ts

@@ -260,7 +260,7 @@ export class StructureSelectionManager extends StatefulPluginComponent<Structure
         if (!structure) return;
 
         // oldObj is not defined for inserts (e.g. TransformStructureConformation)
-        if (!oldObj || Structure.areUnitAndIndicesEqual(oldObj.data, obj.data)) {
+        if (!oldObj?.data || Structure.areUnitAndIndicesEqual(oldObj.data, obj.data)) {
             this.entries.set(ref, remapSelectionEntry(this.entries.get(ref)!, structure));
 
             // remap referenceLoci & prevHighlight if needed and possible