UNPKG

molstar

Version:

A comprehensive macromolecular library.

38 lines (37 loc) 1.64 kB
/** * Copyright (c) 2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { PluginBehavior } from '../../../behavior.js'; import { ParamDefinition as PD } from '../../../../../mol-util/param-definition.js'; import { StreamlinesProvider } from '../../../../../mol-model-props/volume/streamlines.js'; import { StreamlinesRepresentationProvider } from '../../../../../mol-model-props/volume/streamlines/representation.js'; export const Streamlines = PluginBehavior.create({ name: 'streamlines-volume-prop', category: 'custom-props', display: { name: 'Streamlines' }, ctor: class extends PluginBehavior.Handler { constructor() { super(...arguments); this.provider = StreamlinesProvider; } update(p) { const updated = (this.params.autoAttach !== p.autoAttach); this.params.autoAttach = p.autoAttach; this.ctx.customVolumeProperties.setDefaultAutoAttach(this.provider.descriptor.name, this.params.autoAttach); return updated; } register() { this.ctx.customVolumeProperties.register(this.provider, this.params.autoAttach); this.ctx.representation.volume.registry.add(StreamlinesRepresentationProvider); } unregister() { this.ctx.customVolumeProperties.unregister(this.provider.descriptor.name); this.ctx.representation.volume.registry.remove(StreamlinesRepresentationProvider); } }, params: () => ({ autoAttach: PD.Boolean(false) }) });