|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
+ * Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
*
|
|
|
* @author David Sehnal <david.sehnal@gmail.com>
|
|
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
@@ -71,6 +71,7 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
await update.commit();
|
|
|
await this.plugin.state.updateBehavior(StructureFocusRepresentation, p => {
|
|
|
p.ignoreHydrogens = !options.showHydrogens;
|
|
|
+ p.ignoreLight = options.ignoreLight;
|
|
|
p.material = options.materialStyle;
|
|
|
p.clip = options.clipObjects;
|
|
|
});
|
|
@@ -79,16 +80,17 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
}
|
|
|
|
|
|
private updateReprParams(update: StateBuilder.Root, component: StructureComponentRef) {
|
|
|
- const { showHydrogens, visualQuality: quality, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = 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 || !shallowEqual(params.type.params.material, material) || !PD.areEqual(Clip.Params, params.type.params.clip, clip)) {
|
|
|
+ if (!!params.type.params.ignoreHydrogens !== ignoreHydrogens || params.type.params.quality !== quality || params.type.params.ignoreLight !== ignoreLight || !shallowEqual(params.type.params.material, material) || !PD.areEqual(Clip.Params, params.type.params.clip, clip)) {
|
|
|
update.to(r.cell).update(old => {
|
|
|
old.type.params.ignoreHydrogens = ignoreHydrogens;
|
|
|
old.type.params.quality = quality;
|
|
|
+ old.type.params.ignoreLight = ignoreLight;
|
|
|
old.type.params.material = material;
|
|
|
old.type.params.clip = clip;
|
|
|
});
|
|
@@ -309,9 +311,9 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
addRepresentation(components: ReadonlyArray<StructureComponentRef>, type: string) {
|
|
|
if (components.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality, material, clip };
|
|
|
+ const typeParams = { ignoreHydrogens, quality, ignoreLight, material, clip };
|
|
|
|
|
|
return this.plugin.dataTransaction(async () => {
|
|
|
for (const component of components) {
|
|
@@ -346,9 +348,9 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
const xs = structures || this.currentStructures;
|
|
|
if (xs.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality, material, clip };
|
|
|
+ const typeParams = { ignoreHydrogens, quality, ignoreLight, material, clip };
|
|
|
|
|
|
const componentKey = UUID.create22();
|
|
|
for (const s of xs) {
|
|
@@ -458,6 +460,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' }),
|
|
|
+ ignoreLight: PD.Boolean(false, { description: 'Ignore light for stylized rendering of representtions' }),
|
|
|
materialStyle: Material.getParam(),
|
|
|
clipObjects: PD.Group(Clip.Params),
|
|
|
interactions: PD.Group(InteractionsProvider.defaultParams, { label: 'Non-covalent Interactions' }),
|