Przeglądaj źródła

cameraFocus bug fixed

bioinsilico 2 lat temu
rodzic
commit
4801d040b0

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "2.2.0-uniprot-msa.6",
+  "version": "2.2.0-uniprot-msa.7",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/app.js",
   "files": [

+ 15 - 5
src/RcsbFvStructure/StructureViewerBehaviour/UniprotBehaviour.ts

@@ -83,13 +83,12 @@ class UniprotBehaviour<R> implements StructureViewerBehaviourInterface {
     }
 
     async featureClick(data?: SelectedRegion[]): Promise<void> {
-        let onetimeCall = (d: SelectedRegion) => {
+        const cameraFocus = onetimeCall<SelectedRegion>((d: SelectedRegion) => {
             const {modelId, labelAsymId, region, operatorName} = d;
             const regions = [region];
             const residues: number[] = regions.map(r=> r.begin == r.end ? [r.begin] : [r.begin,r.end]).flat().filter(r=>r!=null);
             this.structureViewer.cameraFocus(modelId, labelAsymId, residues, operatorName);
-            onetimeCall = ()=>{};
-        };
+        });
         await this.removeComponent();
         if(!data || data.length == 0)
             this.resetPluginView();
@@ -102,12 +101,13 @@ class UniprotBehaviour<R> implements StructureViewerBehaviourInterface {
                     return;
                 if(residues.length == 1)
                     this.structureViewer.setFocus(modelId,labelAsymId,residues[0],residues[0],operatorName);
-                onetimeCall(d);
+                cameraFocus.call(d);
                 const ranges: SaguaroRange[] = regions.map(r=>({
                     modelId,
                     labelAsymId,
                     begin: r.begin,
-                    end: r.end
+                    end: r.end,
+                    operatorName
                 }));
                 const nRes = ranges.map(r=>r.end-r.begin+1).reduce((prev,curr)=>curr+prev,0);
                 if( nRes <= this.CREATE_COMPONENT_THR)
@@ -201,4 +201,14 @@ class UniprotBehaviour<R> implements StructureViewerBehaviourInterface {
         }));
     }
 
+}
+
+function onetimeCall<P>(f:(x:P)=>void): {call: (x:P)=>void} {
+    const g = {
+        call:(x:P)=>{
+            f(x)
+            g.call = (x)=>{}
+        }
+    };
+    return g;
 }