|
@@ -30,6 +30,7 @@ import { Clipping } from '../../../mol-theme/clipping';
|
|
|
import { setStructureClipping } from '../../helpers/structure-clipping';
|
|
|
import { setStructureTransparency } from '../../helpers/structure-transparency';
|
|
|
import { StructureFocusRepresentation } from '../../../mol-plugin/behavior/dynamic/selection/structure-focus-representation';
|
|
|
+import { Material } from '../../../mol-util/material';
|
|
|
|
|
|
export { StructureComponentManager };
|
|
|
|
|
@@ -67,22 +68,24 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
await update.commit();
|
|
|
await this.plugin.state.updateBehavior(StructureFocusRepresentation, p => {
|
|
|
p.ignoreHydrogens = !options.showHydrogens;
|
|
|
+ p.material = options.materialStyle;
|
|
|
});
|
|
|
if (interactionChanged) await this.updateInterationProps();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
private updateReprParams(update: StateBuilder.Root, component: StructureComponentRef) {
|
|
|
- const { showHydrogens, visualQuality: quality } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, materialStyle: material } = this.state.options;
|
|
|
const ignoreHydrogens = !showHydrogens;
|
|
|
for (const r of component.representations) {
|
|
|
if (r.cell.transform.transformer !== StructureRepresentation3D) continue;
|
|
|
|
|
|
const params = r.cell.transform.params as StateTransformer.Params<StructureRepresentation3D>;
|
|
|
- if (!!params.type.params.ignoreHydrogens !== ignoreHydrogens || params.type.params.quality !== quality) {
|
|
|
+ if (!!params.type.params.ignoreHydrogens !== ignoreHydrogens || params.type.params.quality !== quality || params.type.params.material !== material) {
|
|
|
update.to(r.cell).update(old => {
|
|
|
old.type.params.ignoreHydrogens = ignoreHydrogens;
|
|
|
old.type.params.quality = quality;
|
|
|
+ old.type.params.material = material;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -301,9 +304,9 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
addRepresentation(components: ReadonlyArray<StructureComponentRef>, type: string) {
|
|
|
if (components.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, materialStyle: material } = this.state.options;
|
|
|
const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality };
|
|
|
+ const typeParams = { ignoreHydrogens, quality, material };
|
|
|
|
|
|
return this.plugin.dataTransaction(async () => {
|
|
|
for (const component of components) {
|
|
@@ -338,9 +341,9 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
const xs = structures || this.currentStructures;
|
|
|
if (xs.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, materialStyle: material } = this.state.options;
|
|
|
const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality };
|
|
|
+ const typeParams = { ignoreHydrogens, quality, material };
|
|
|
|
|
|
const componentKey = UUID.create22();
|
|
|
for (const s of xs) {
|
|
@@ -445,6 +448,7 @@ namespace StructureComponentManager {
|
|
|
export const OptionsParams = {
|
|
|
showHydrogens: PD.Boolean(true, { description: 'Toggle display of hydrogen atoms in representations' }),
|
|
|
visualQuality: PD.Select('auto', VisualQualityOptions, { description: 'Control the visual/rendering quality of representations' }),
|
|
|
+ materialStyle: Material.getParam(),
|
|
|
interactions: PD.Group(InteractionsProvider.defaultParams, { label: 'Non-covalent Interactions' }),
|
|
|
};
|
|
|
export type Options = PD.Values<typeof OptionsParams>
|