Browse Source

mol-plugin: added InitVolumeStreaming binding param

David Sehnal 5 years ago
parent
commit
6c0938db50

+ 3 - 3
src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

@@ -49,11 +49,11 @@ export namespace VolumeStreaming {
         valuesInfo: [{ mean: 0, min: -1, max: 1, sigma: 0.1 }, { mean: 0, min: -1, max: 1, sigma: 0.1 }]
     };
 
-    const DefaultBindings = {
+    export const DefaultBindings = {
         clickVolumeAroundOnly: Binding(Trigger(B.Flag.Secondary, M.create()), 'Show the volume around only the clicked element using ${trigger}.'),
     }
 
-    export function createParams(data?: VolumeServerInfo.Data, defaultView?: ViewTypes) {
+    export function createParams(data?: VolumeServerInfo.Data, defaultView?: ViewTypes, binding?: typeof DefaultBindings) {
         // fake the info
         const info = data || { kind: 'em', header: { sampling: [fakeSampling], availablePrecisions: [{ precision: 0, maxVoxels: 0 }] }, emDefaultContourLevel: VolumeIsoValue.relative(0) };
         const box = (data && data.structure.boundary.box) || Box3D.empty();
@@ -84,7 +84,7 @@ export namespace VolumeStreaming {
                     'fo-fc(+ve)': channelParam('Fo-Fc(+ve)', Color(0x33BB33), VolumeIsoValue.relative(3), info.header.sampling[0].valuesInfo[1]),
                     'fo-fc(-ve)': channelParam('Fo-Fc(-ve)', Color(0xBB3333), VolumeIsoValue.relative(-3), info.header.sampling[0].valuesInfo[1]),
                 }, { isFlat: true }),
-            bindings: PD.Value(DefaultBindings, { isHidden: true }),
+            bindings: PD.Value(binding || DefaultBindings, { isHidden: true }),
         };
     }
 

+ 2 - 1
src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts

@@ -35,6 +35,7 @@ export const InitVolumeStreaming = StateAction.build({
             defaultView: PD.Select<VolumeStreaming.ViewTypes>(method === 'em' ? 'cell' : 'selection-box', VolumeStreaming.ViewTypeOptions as any),
             behaviorRef: PD.Text('', { isHidden: true }),
             emContourProvider: PD.Select<'wwpdb' | 'pdbe'>('wwpdb', [['wwpdb', 'wwPDB'], ['pdbe', 'PDBe']], { isHidden: true }),
+            bindings: PD.Value(VolumeStreaming.DefaultBindings, { isHidden: true }),
         };
     },
     isApplicable: (a) => a.data.models.length === 1
@@ -61,7 +62,7 @@ export const InitVolumeStreaming = StateAction.build({
     const infoObj = await state.updateTree(infoTree).runInContext(taskCtx);
 
     const behTree = state.build().to(infoTree.ref).apply(CreateVolumeStreamingBehavior,
-        PD.getDefaultValues(VolumeStreaming.createParams(infoObj.data, params.defaultView)),
+        PD.getDefaultValues(VolumeStreaming.createParams(infoObj.data, params.defaultView, params.bindings)),
         { ref: params.behaviorRef ? params.behaviorRef : void 0 });
 
     if (params.method === 'em') {