Forráskód Böngészése

resetCamera method

bioinsilico 4 éve
szülő
commit
0c8cd06713

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "0.0.13",
+  "version": "0.0.14",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/RcsbFv3DBuilder.js",
   "files": [

+ 3 - 8
src/RcsbFvSequence/SequenceViews/AssemblyView.tsx

@@ -80,9 +80,7 @@ export class AssemblyView extends AbstractView<AssemblyViewInterface & AbstractV
                 this.props.plugin.clearSelection('select', {modelId: this.currentModelId, labelAsymId: this.currentLabelAsymId});
                 this.props.selection.clearSelection('select', this.currentLabelAsymId);
                 if(selection == null || selection.length === 0) {
-                    this.props.plugin.pluginCall(plugin => {
-                        plugin.managers.camera.reset();
-                    });
+                    this.props.plugin.resetCamera();
                     return;
                 }
                 this.select(selection);
@@ -114,7 +112,7 @@ export class AssemblyView extends AbstractView<AssemblyViewInterface & AbstractV
     }
 
     protected structureSelectionCallback(): void{
-       this.pluginSelectCallback('select');
+        this.pluginSelectCallback('select');
     }
 
     protected structureHoverCallback(): void{
@@ -130,10 +128,6 @@ export class AssemblyView extends AbstractView<AssemblyViewInterface & AbstractV
         const allSel: Array<ChainSelectionInterface> | undefined = this.props.selection.getSelection(mode);
         if(allSel == null || allSel.length ===0) {
             getRcsbFv(this.pfvDivId).clearSelection(mode);
-            if(mode === 'select')
-                this.props.plugin.pluginCall(plugin => {
-                    plugin.managers.camera.reset();
-                });
         }else{
             const sel: ChainSelectionInterface | undefined = this.props.selection.getSelectionWithCondition(this.currentModelId, this.currentLabelAsymId, mode);
             if (sel == null) {
@@ -153,6 +147,7 @@ export class AssemblyView extends AbstractView<AssemblyViewInterface & AbstractV
                 this.currentEntryId = v.entryId;
                 this.currentLabelAsymId = x.asymId;
                 this.currentModelId = k;
+                this.props.plugin.resetCamera();
                 setTimeout(()=>{
                     this.structureSelectionCallback();
                 },1000);

+ 3 - 0
src/RcsbFvStructure/StructurePlugins/MolstarPlugin.ts

@@ -338,6 +338,9 @@ export class MolstarPlugin extends AbstractPlugin implements SaguaroPluginInterf
         this.modelChangeCallbackSubs?.unsubscribe();
     }
 
+    public resetCamera(): void {
+        this.plugin.getPlugin().managers.camera.reset();
+    }
 
 }
 

+ 1 - 0
src/RcsbFvStructure/StructurePlugins/SaguaroPluginInterface.ts

@@ -25,4 +25,5 @@ export interface SaguaroPluginPublicInterface {
     getComponentSet: () => Set<string>;
     focusPositions: (modelId: string, asymId: string, positions:Array<number>)=> void;
     focusRange: (modelId: string, asymId: string, begin: number, end: number) => void;
+    resetCamera: ()=>void;
 }