Selaa lähdekoodia

Custom sequence viewer as a plugin spec (#988)

Factored out of #936

Co-authored-by: David Sehnal <dsehnal@users.noreply.github.com>
Yakov Pechersky 1 vuosi sitten
vanhempi
commit
ef17cb2cca
4 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 1 0
      CHANGELOG.md
  2. 2 1
      package.json
  3. 2 1
      src/mol-plugin-ui/plugin.tsx
  4. 3 0
      src/mol-plugin-ui/spec.ts

+ 1 - 0
CHANGELOG.md

@@ -18,6 +18,7 @@ Note that since we don't clearly distinguish between a public and private interf
 - Do not activate drag overlay for non-file content
 - Add `structure-element-sphere` visual to `spacefill` representation
 - Fix missing `await` in `HeadlessPluginContext.saveStateSnapshot`
+- Added support for providing custom sequence viewers to the plugin spec
 - MolViewSpec extension (MVS)
 - Add URL parameters `mvs-url`, `mvs-data`, `mvs-format`
 - Add drag&drop for `.mvsj` files

+ 2 - 1
package.json

@@ -99,7 +99,8 @@
     "Zhenyu Zhang <jump2cn@gmail.com>",
     "Russell Parker <russell@benchling.com>",
     "Dominik Tichy <tichydominik451@gmail.com>",
-    "Yana Rose <yana.v.rose@gmail.com>"
+    "Yana Rose <yana.v.rose@gmail.com>",
+    "Yakov Pechersky <ffxen158@gmail.com>"
   ],
   "license": "MIT",
   "devDependencies": {

+ 2 - 1
src/mol-plugin-ui/plugin.tsx

@@ -193,12 +193,13 @@ class Layout extends PluginUIComponent {
         const layout = this.plugin.layout.state;
         const controls = this.plugin.spec.components?.controls || {};
         const viewport = this.plugin.spec.components?.viewport?.view || DefaultViewport;
+        const sequenceView = this.plugin.spec.components?.sequenceViewer?.view || SequenceView;
 
         return <div className='msp-plugin'>
             <div className={this.layoutClassName} onDragEnter={this.onDragEnter}>
                 <div className={this.layoutVisibilityClassName}>
                     {this.region('main', viewport)}
-                    {layout.showControls && controls.top !== 'none' && this.region('top', controls.top || SequenceView)}
+                    {layout.showControls && controls.top !== 'none' && this.region('top', controls.top || sequenceView)}
                     {layout.showControls && controls.left !== 'none' && this.region('left', controls.left || LeftPanelControls)}
                     {layout.showControls && controls.right !== 'none' && this.region('right', controls.right || ControlsWrapper)}
                     {layout.showControls && controls.bottom !== 'none' && this.region('bottom', controls.bottom || Log)}

+ 3 - 0
src/mol-plugin-ui/spec.ts

@@ -24,6 +24,9 @@ interface PluginUISpec extends PluginSpec {
             view?: React.ComponentClass,
             controls?: React.ComponentClass
         },
+        sequenceViewer?: {
+            view?: React.ComponentClass
+        }
         hideTaskOverlay?: boolean,
         disableDragOverlay?: boolean,
     },