index.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { PluginBehavior } from '../../mol-plugin/behavior';
  7. import { LoadCellPackModel } from './model';
  8. import { CellPackGenerateColorThemeProvider } from './color/generate';
  9. import { CellPackProvidedColorThemeProvider } from './color/provided';
  10. export const CellPack = PluginBehavior.create<{ autoAttach: boolean, showTooltip: boolean }>({
  11. name: 'cellpack',
  12. category: 'custom-props',
  13. display: {
  14. name: 'CellPack',
  15. description: 'CellPack Model Loading and Viewing.'
  16. },
  17. ctor: class extends PluginBehavior.Handler<{ autoAttach: boolean, showTooltip: boolean }> {
  18. register(): void {
  19. this.ctx.state.data.actions.add(LoadCellPackModel);
  20. this.ctx.representation.structure.themes.colorThemeRegistry.add(CellPackGenerateColorThemeProvider);
  21. this.ctx.representation.structure.themes.colorThemeRegistry.add(CellPackProvidedColorThemeProvider);
  22. }
  23. unregister() {
  24. this.ctx.state.data.actions.remove(LoadCellPackModel);
  25. this.ctx.representation.structure.themes.colorThemeRegistry.remove(CellPackGenerateColorThemeProvider);
  26. this.ctx.representation.structure.themes.colorThemeRegistry.remove(CellPackProvidedColorThemeProvider);
  27. }
  28. }
  29. });