Browse Source

reset camera after all alignments

Sebastian Bittrich 3 years ago
parent
commit
9841c773cb
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/mol-plugin-ui/structure/superposition.tsx

+ 8 - 2
src/mol-plugin-ui/structure/superposition.tsx

@@ -150,6 +150,7 @@ export class SuperpositionControls extends PurePluginUIComponent<{ }, Superposit
             const labelB = stripTags(eB.label);
             this.plugin.log.info(`Superposed [${labelA}] and [${labelB}] with RMSD ${rmsd.toFixed(2)}.`);
         }
+        await this.cameraReset();
     };
 
     superposeAtoms = async () => {
@@ -173,6 +174,7 @@ export class SuperpositionControls extends PurePluginUIComponent<{ }, Superposit
             const count = entries[i].atoms.length;
             this.plugin.log.info(`Superposed ${count} ${count === 1 ? 'atom' : 'atoms'} of [${labelA}] and [${labelB}] with RMSD ${rmsd.toFixed(2)}.`);
         }
+        await this.cameraReset();
     };
 
     superposeDb = async () => {
@@ -205,11 +207,15 @@ export class SuperpositionControls extends PurePluginUIComponent<{ }, Superposit
 
         if (entries.length) {
             this.plugin.log.info(`Superposed ${entries.length + 1} structures with avg. RMSD ${rmsd.toFixed(2)} Å.`);
-            await new Promise(res => requestAnimationFrame(res));
-            PluginCommands.Camera.Reset(this.plugin);
+            await this.cameraReset();
         }
     };
 
+    async cameraReset() {
+        await new Promise(res => requestAnimationFrame(res));
+        PluginCommands.Camera.Reset(this.plugin);
+    }
+
     toggleByChains = () => this.setState({ action: this.state.action === 'byChains' ? void 0 : 'byChains' });
     toggleByAtoms = () => this.setState({ action: this.state.action === 'byAtoms' ? void 0 : 'byAtoms' });
     toggleOptions = () => this.setState({ action: this.state.action === 'options' ? void 0 : 'options' });