Przeglądaj źródła

checkboxes can use molstar info to display component availability

bioinsilico 1 rok temu
rodzic
commit
de151a0e81

+ 5 - 0
CHANGELOG.md

@@ -2,6 +2,11 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [4.0.11] - 2024-03-08
+### Improvement
+- 1D3D checkboxes can use molstar info to display component availability. 
+This is useful for non PDB entries
+
 ## [4.0.10] - 2024-03-06
 ### Improvement
 - div delimiter increased width && transparent

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "4.0.10",
+  "version": "4.0.11",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/app.js",
   "files": [
@@ -20,6 +20,7 @@
     "buildDoc": "typedoc --excludeExternals --externalPattern \"**/node_modules/**\" --plugin typedoc-plugin-missing-exports  --plugin typedoc-theme-hierarchy --theme hierarchy --entryPointStrategy expand ./src && sed -i '' '/---/d' docs/index.html",
     "clean": "del-cli lib && del-cli build",
     "publishApp": "npm publish",
+    "packApp": "npm run buildApp && npm pack",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {

+ 12 - 9
src/RcsbFvSequence/SequenceViews/RcsbView/PfvManagerFactoryImplementation/MsaPfvComponents/MsaRowTitleCheckboxComponent.tsx

@@ -164,12 +164,8 @@ export class MsaRowTitleCheckboxComponent extends React.Component <MsaRowTitleCh
         isVisible:boolean;
         pdb: {entryId:string;entityId:string;} | {entryId:string;instanceId:string;};
     }): Promise<void> {
-        if(this.compId() == this.getRcsbId(data.pdb) && this.props.tag == data.tag){
-            if( data.isVisible)
-                this.setState({checked: true, opacity: await this.opacity()})
-            else
-                this.setState({checked: false, opacity: await this.opacity()})
-        }
+        if(this.compId() == this.getRcsbId(data.pdb) && this.props.tag == data.tag)
+            this.setState({checked: data.isVisible, opacity: data.isComponent ? 1 : await this.opacity()})
     }
 
     private requestInfo(): void {
@@ -190,16 +186,23 @@ export class MsaRowTitleCheckboxComponent extends React.Component <MsaRowTitleCh
     }
 
     private async opacity(): Promise<0 | 1> {
-        switch (this.props.tag){
-            case "aligned":
+        if(this.props.tag == "aligned")
                 return 1;
+        return await this.componentOpacity(this.props.tag);
+
+    }
+
+    private async componentOpacity(componentType: "polymer" | "non-polymer"): Promise<0|1> {
+        if(!TagDelimiter.isRcsbId(this.props.entryId))
+            return 0;
+        switch (componentType) {
             case "polymer":
                 return await this.polymerTest() ? 1 : 0;
             case "non-polymer":
                 return await this.nonPolymerTest() ? 1 : 0;
         }
-
     }
+
     private async polymerTest(): Promise<boolean> {
         const entryId = this.props.entryId;
         const entryInfo = (await rcsbRequestCtxManager.getEntryProperties(entryId))[0];