Browse Source

various ui tweaks

Alexander Rose 5 years ago
parent
commit
e682eb78b0

+ 4 - 4
src/mol-plugin-state/builder/structure/hierarchy-preset.ts

@@ -103,7 +103,7 @@ const CrystalSymmetryParams = (a: PluginStateObject.Molecule.Trajectory | undefi
     ...CommonParams(a, plugin)
 });
 
-async function applyCrystalSymmetry(ijk: { ijkMin: Vec3, ijkMax: Vec3 }, trajectory: StateObjectRef<PluginStateObject.Molecule.Trajectory>, params: PD.ValuesFor<ReturnType<typeof CrystalSymmetryParams>>, plugin: PluginContext) {
+async function applyCrystalSymmetry(props: { ijkMin: Vec3, ijkMax: Vec3, theme?: string }, trajectory: StateObjectRef<PluginStateObject.Molecule.Trajectory>, params: PD.ValuesFor<ReturnType<typeof CrystalSymmetryParams>>, plugin: PluginContext) {
     const builder = plugin.builders.structure;
 
     const model = await builder.createModel(trajectory, params.model);
@@ -111,12 +111,12 @@ async function applyCrystalSymmetry(ijk: { ijkMin: Vec3, ijkMax: Vec3 }, traject
 
     const structure = await builder.createStructure(modelProperties || model, {
         name: 'symmetry',
-        params: ijk
+        params: props
     });
     const structureProperties = await builder.insertStructureProperties(structure, params.structureProperties);
 
     const unitcell = await builder.tryCreateUnitcell(modelProperties, undefined, { isHidden: false });
-    const representation =  await plugin.builders.structure.representation.applyPreset(structureProperties, params.representationPreset || 'auto');
+    const representation =  await plugin.builders.structure.representation.applyPreset(structureProperties, params.representationPreset || 'auto', { globalThemeName: props.theme });
 
     return {
         model,
@@ -148,7 +148,7 @@ const supercell = TrajectoryHierarchyPresetProvider({
     },
     params: CrystalSymmetryParams,
     async apply(trajectory, params, plugin) {
-        return await applyCrystalSymmetry({ ijkMin: Vec3.create(-1, -1, -1), ijkMax: Vec3.create(1, 1, 1) }, trajectory, params, plugin);
+        return await applyCrystalSymmetry({ ijkMin: Vec3.create(-1, -1, -1), ijkMax: Vec3.create(1, 1, 1), theme: 'operator-hkl' }, trajectory, params, plugin);
     }
 });
 

+ 0 - 4
src/mol-plugin-state/manager/structure/hierarchy-state.ts

@@ -186,10 +186,6 @@ type TestCell = (cell: StateObjectCell, state: BuildState) => boolean
 type ApplyRef = (state: BuildState, cell: StateObjectCell) => boolean | void
 type LeaveRef = (state: BuildState) => any
 
-// function isTag(t: string): TestCell {
-//     return (cell) => StateObject.hasTag(cell.obj!, t);
-// }
-
 function isType(t: StateObject.Ctor): TestCell {
     return (cell) => t.is(cell.obj);
 }

+ 1 - 1
src/mol-plugin-ui/structure/measurements.tsx

@@ -145,7 +145,7 @@ export class MeasurementControls extends PurePluginUIComponent<{}, { isBusy: boo
     historyEntry(e: StructureSelectionHistoryEntry, idx: number) {
         const history = this.plugin.managers.structure.selection.additionsHistory;
         return <div className='msp-btn-row-group' key={e.id}>
-            <button className='msp-btn msp-btn-block msp-form-control' title='Click to focus. Hover to highlight.' onClick={() => this.focusLoci(e.loci)} style={{ width: 'auto', textAlign: 'left' }} onMouseEnter={() => this.highlight(e.loci)} onMouseLeave={this.plugin.managers.interactivity.lociHighlights.clearHighlights}>
+            <button className='msp-btn msp-btn-block msp-form-control msp-no-overflow' title='Click to focus. Hover to highlight.' onClick={() => this.focusLoci(e.loci)} style={{ width: 'auto', textAlign: 'left' }} onMouseEnter={() => this.highlight(e.loci)} onMouseLeave={this.plugin.managers.interactivity.lociHighlights.clearHighlights}>
                 {idx}. <span dangerouslySetInnerHTML={{ __html: e.label }} />
             </button>
             {history.length > 1 && <IconButton small={true} customClass='msp-form-control' onClick={() => this.moveHistory(e, 'up')} icon='up-thin' style={{ flex: '0 0 20px', maxWidth: '20px', padding: 0 }} title={'Move up'} />}

+ 5 - 0
src/mol-plugin-ui/structure/volume.tsx

@@ -11,6 +11,7 @@ import { ApplyActionControl } from '../state/apply-action';
 import { UpdateTransformControl } from '../state/update-transform';
 import { BindingsHelp } from '../viewport/help';
 import { ExpandGroup } from '../controls/common';
+import { StructureHierarchyManager } from '../../mol-plugin-state/manager/structure/hierarchy';
 
 interface VolumeStreamingControlState extends CollapsableState {
     isBusy: boolean
@@ -30,6 +31,10 @@ export class VolumeStreamingControls extends CollapsableControls<{}, VolumeStrea
         // TODO: do not hide this but instead show some help text??
         this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, () => this.setState({ isHidden: !this.canEnable() }));
         this.subscribe(this.plugin.behaviors.state.isBusy, v => this.setState({ isBusy: v }));
+
+        this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, c => this.setState({
+            description: StructureHierarchyManager.getSelectedStructuresDescription(this.plugin)
+        }));
     }
 
     get pivot() {