controls.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { PluginUIComponent } from 'molstar/lib/mol-plugin-ui/base';
  7. import { ViewerState } from '../types';
  8. import { CustomStructureControls } from 'molstar/lib/mol-plugin-ui/controls';
  9. import { ImportControls } from './import';
  10. import { ExportControls } from './export';
  11. import { StructureSourceControls } from 'molstar/lib/mol-plugin-ui/structure/source';
  12. import { StructureMeasurementsControls } from 'molstar/lib/mol-plugin-ui/structure/measurements';
  13. import { StructureSuperpositionControls } from 'molstar/lib/mol-plugin-ui/structure/superposition';
  14. import { StructureComponentControls } from 'molstar/lib/mol-plugin-ui/structure/components';
  15. import { VolumeStreamingControls } from 'molstar/lib/mol-plugin-ui/structure/volume';
  16. import { SessionControls } from './session';
  17. import { StrucmotifSubmitControls } from './strucmotif';
  18. import { Mp4EncoderUI } from 'molstar/lib/extensions/mp4-export/ui';
  19. export class StructureTools extends PluginUIComponent {
  20. get customState() {
  21. return ViewerState(this.plugin);
  22. }
  23. componentDidMount() {
  24. this.subscribe(this.customState.collapsed, () => this.forceUpdate());
  25. }
  26. render() {
  27. const collapsed = this.customState.collapsed.value;
  28. return <>
  29. {this.customState.showStructureSourceControls && <StructureSourceControls />}
  30. <StructureMeasurementsControls initiallyCollapsed={collapsed.measurements} />
  31. <StrucmotifSubmitControls initiallyCollapsed={collapsed.strucmotifSubmit} />
  32. {this.customState.showSuperpositionControls && <StructureSuperpositionControls initiallyCollapsed={collapsed.superposition} />}
  33. <StructureComponentControls initiallyCollapsed={collapsed.component} />
  34. <VolumeStreamingControls header='Density' initiallyCollapsed={collapsed.volume} />
  35. <CustomStructureControls initiallyCollapsed={collapsed.custom} />
  36. <Mp4EncoderUI initiallyCollapsed={collapsed.mp4export}/>
  37. </>;
  38. }
  39. }
  40. export class ControlsWrapper extends PluginUIComponent {
  41. render() {
  42. return <div className='msp-scrollable-container'>
  43. {ViewerState(this.plugin).showImportControls && <ImportControls />}
  44. {ViewerState(this.plugin).showExportControls && <ExportControls />}
  45. {ViewerState(this.plugin).showSessionControls && <SessionControls />}
  46. <StructureTools />
  47. </div>;
  48. }
  49. }