Skip to content
Snippets Groups Projects
Commit 6c0938db authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: added InitVolumeStreaming binding param

parent b76173c8
No related branches found
No related tags found
No related merge requests found
...@@ -49,11 +49,11 @@ export namespace VolumeStreaming { ...@@ -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 }] 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}.'), 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 // fake the info
const info = data || { kind: 'em', header: { sampling: [fakeSampling], availablePrecisions: [{ precision: 0, maxVoxels: 0 }] }, emDefaultContourLevel: VolumeIsoValue.relative(0) }; 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(); const box = (data && data.structure.boundary.box) || Box3D.empty();
...@@ -84,7 +84,7 @@ export namespace VolumeStreaming { ...@@ -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(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]), 'fo-fc(-ve)': channelParam('Fo-Fc(-ve)', Color(0xBB3333), VolumeIsoValue.relative(-3), info.header.sampling[0].valuesInfo[1]),
}, { isFlat: true }), }, { isFlat: true }),
bindings: PD.Value(DefaultBindings, { isHidden: true }), bindings: PD.Value(binding || DefaultBindings, { isHidden: true }),
}; };
} }
......
...@@ -35,6 +35,7 @@ export const InitVolumeStreaming = StateAction.build({ ...@@ -35,6 +35,7 @@ export const InitVolumeStreaming = StateAction.build({
defaultView: PD.Select<VolumeStreaming.ViewTypes>(method === 'em' ? 'cell' : 'selection-box', VolumeStreaming.ViewTypeOptions as any), defaultView: PD.Select<VolumeStreaming.ViewTypes>(method === 'em' ? 'cell' : 'selection-box', VolumeStreaming.ViewTypeOptions as any),
behaviorRef: PD.Text('', { isHidden: true }), behaviorRef: PD.Text('', { isHidden: true }),
emContourProvider: PD.Select<'wwpdb' | 'pdbe'>('wwpdb', [['wwpdb', 'wwPDB'], ['pdbe', 'PDBe']], { 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 isApplicable: (a) => a.data.models.length === 1
...@@ -61,7 +62,7 @@ export const InitVolumeStreaming = StateAction.build({ ...@@ -61,7 +62,7 @@ export const InitVolumeStreaming = StateAction.build({
const infoObj = await state.updateTree(infoTree).runInContext(taskCtx); const infoObj = await state.updateTree(infoTree).runInContext(taskCtx);
const behTree = state.build().to(infoTree.ref).apply(CreateVolumeStreamingBehavior, 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 }); { ref: params.behaviorRef ? params.behaviorRef : void 0 });
if (params.method === 'em') { if (params.method === 'em') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment