Browse Source

option to show membrane extension

JonStargaryen 3 years ago
parent
commit
74c6236fae
3 changed files with 11 additions and 3 deletions
  1. 4 0
      CHANGELOG.md
  2. 1 0
      src/viewer/index.html
  3. 6 3
      src/viewer/index.ts

+ 4 - 0
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 [Semantic Versioning](https://semver.org/)
 
+## [1.6.4] - 2021-06-02
+### Added
+- Option to show membrane orientation preset
+
 ## [1.6.3] - 2021-06-01
 ### Bug fixes
 - Improve quality of ANVIL prediction

+ 1 - 0
src/viewer/index.html

@@ -61,6 +61,7 @@
                 showSessionControls: !pdbId,
                 layoutShowLog: !pdbId,
                 layoutShowControls: !isEmbedded,
+                showMembraneOrientationPreset: true
             })
 
             // load pdbId or url

+ 6 - 3
src/viewer/index.ts

@@ -60,6 +60,7 @@ const DefaultViewerProps = {
     showSessionControls: false,
     showStructureSourceControls: true,
     showSuperpositionControls: true,
+    showMembraneOrientationPreset: false,
     modelUrlProviders: [
         (pdbId: string) => ({
             url: `https://models.rcsb.org/${pdbId.toLowerCase()}.bcif`,
@@ -165,12 +166,13 @@ export class Viewer {
         this.plugin.init()
             .then(async () => {
                 // hide 'Membrane Orientation' preset from UI - has to happen 'before' react render, apparently
-                this.plugin.builders.structure.representation.unregisterPreset(MembraneOrientationPreset);
-                this.plugin.representation.structure.registry.remove(MembraneOrientationRepresentationProvider);
+                if (!o.showMembraneOrientationPreset) {
+                    this.plugin.builders.structure.representation.unregisterPreset(MembraneOrientationPreset);
+                    this.plugin.representation.structure.registry.remove(MembraneOrientationRepresentationProvider);
+                }
 
                 ReactDOM.render(React.createElement(Plugin, { plugin: this.plugin }), element);
 
-                // TODO confirm if this.plugin.canvas3d is still null
                 const renderer = this.plugin.canvas3d!.props.renderer;
                 await PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer: { ...renderer, backgroundColor: o.backgroundColor } } });
                 this.plugin.representation.structure.themes.colorThemeRegistry.add(SuperposeColorThemeProvider);
@@ -223,6 +225,7 @@ export class Viewer {
                 await this.customState.modelLoader.load({ fileOrUrl: p.url, format: p.format, isBinary: p.isBinary }, props, matrix);
                 break;
             } catch (e) {
+
                 console.warn(`loading '${pdbId}' failed with '${e}', trying next model-loader-provider`);
             }
         }