Browse Source

make toast message and background color configurable

JonStargaryen 4 years ago
parent
commit
376926032f
2 changed files with 13 additions and 9 deletions
  1. 0 1
      src/viewer/helpers/model.ts
  2. 13 8
      src/viewer/index.ts

+ 0 - 1
src/viewer/helpers/model.ts

@@ -24,7 +24,6 @@ export class ModelLoader {
 
     async parse(parse: ParseParams, props?: PresetProps & { dataLabel?: string }, matrix?: Mat4) {
         const { data, format } = parse;
-        console.log(typeof data);
         const _data = await this.plugin.builders.data.rawData({ data, label: props?.dataLabel });
         await this.handleTrajectory(_data, format, props, matrix);
     }

+ 13 - 8
src/viewer/index.ts

@@ -70,6 +70,9 @@ const DefaultViewerProps = {
     viewportShowExpand: true,
     viewportShowSelectionMode: true,
     volumeStreamingServer: '//maps.rcsb.org/',
+
+    backgroundColor: ColorNames.white,
+    showWelcomeToast: true
 };
 type ViewerProps = typeof DefaultViewerProps
 
@@ -142,14 +145,16 @@ export class Viewer {
         ReactDOM.render(React.createElement(Plugin, { plugin: this.plugin }), target)
 
         const renderer = this.plugin.canvas3d!.props.renderer;
-        PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer: { ...renderer, backgroundColor: ColorNames.white } } });
-
-        PluginCommands.Toast.Show(this.plugin, {
-            title: 'Welcome',
-            message: `RCSB PDB Mol* Viewer ${RCSB_MOLSTAR_VERSION} [${BUILD_DATE.toLocaleString()}]`,
-            key: 'toast-welcome',
-            timeoutMs: 5000
-        })
+        PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer: { ...renderer, backgroundColor: o.backgroundColor } } });
+
+        if (o.showWelcomeToast) {
+            PluginCommands.Toast.Show(this.plugin, {
+                title: 'Welcome',
+                message: `RCSB PDB Mol* Viewer ${RCSB_MOLSTAR_VERSION} [${BUILD_DATE.toLocaleString()}]`,
+                key: 'toast-welcome',
+                timeoutMs: 5000
+            })
+        }
     }
 
     //