|
@@ -70,7 +70,8 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
return this.plugin.dataTransaction(async () => {
|
|
|
await update.commit();
|
|
|
await this.plugin.state.updateBehavior(StructureFocusRepresentation, p => {
|
|
|
- p.ignoreHydrogens = !options.showHydrogens;
|
|
|
+ p.ignoreHydrogens = options.hydrogens === 'hide-all';
|
|
|
+ p.onlyPolarHydrogens = options.hydrogens === 'only-polar';
|
|
|
p.ignoreLight = options.ignoreLight;
|
|
|
p.material = options.materialStyle;
|
|
|
p.clip = options.clipObjects;
|
|
@@ -80,15 +81,17 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
}
|
|
|
|
|
|
private updateReprParams(update: StateBuilder.Root, component: StructureComponentRef) {
|
|
|
- const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
- const ignoreHydrogens = !showHydrogens;
|
|
|
+ const { hydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const ignoreHydrogens = hydrogens === 'hide-all';
|
|
|
+ const onlyPolarHydrogens = hydrogens === 'only-polar';
|
|
|
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 || params.type.params.ignoreLight !== ignoreLight || !shallowEqual(params.type.params.material, material) || !PD.areEqual(Clip.Params, params.type.params.clip, clip)) {
|
|
|
+ if (!!params.type.params.ignoreHydrogens !== ignoreHydrogens || !!params.type.params.onlyPolarHydrogens !== onlyPolarHydrogens || 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.onlyPolarHydrogens = onlyPolarHydrogens;
|
|
|
old.type.params.quality = quality;
|
|
|
old.type.params.ignoreLight = ignoreLight;
|
|
|
old.type.params.material = material;
|
|
@@ -311,9 +314,10 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
addRepresentation(components: ReadonlyArray<StructureComponentRef>, type: string) {
|
|
|
if (components.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
- const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality, ignoreLight, material, clip };
|
|
|
+ const { hydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const ignoreHydrogens = hydrogens === 'hide-all';
|
|
|
+ const onlyPolarHydrogens = hydrogens === 'only-polar';
|
|
|
+ const typeParams = { ignoreHydrogens, onlyPolarHydrogens, quality, ignoreLight, material, clip };
|
|
|
|
|
|
return this.plugin.dataTransaction(async () => {
|
|
|
for (const component of components) {
|
|
@@ -348,9 +352,10 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
const xs = structures || this.currentStructures;
|
|
|
if (xs.length === 0) return;
|
|
|
|
|
|
- const { showHydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
- const ignoreHydrogens = !showHydrogens;
|
|
|
- const typeParams = { ignoreHydrogens, quality, ignoreLight, material, clip };
|
|
|
+ const { hydrogens, visualQuality: quality, ignoreLight, materialStyle: material, clipObjects: clip } = this.state.options;
|
|
|
+ const ignoreHydrogens = hydrogens === 'hide-all';
|
|
|
+ const onlyPolarHydrogens = hydrogens === 'only-polar';
|
|
|
+ const typeParams = { ignoreHydrogens, onlyPolarHydrogens, quality, ignoreLight, material, clip };
|
|
|
|
|
|
const componentKey = UUID.create22();
|
|
|
for (const s of xs) {
|
|
@@ -458,9 +463,13 @@ class StructureComponentManager extends StatefulPluginComponent<StructureCompone
|
|
|
|
|
|
namespace StructureComponentManager {
|
|
|
export const OptionsParams = {
|
|
|
- showHydrogens: PD.Boolean(true, { description: 'Toggle display of hydrogen atoms in representations' }),
|
|
|
+ hydrogens: PD.Select(
|
|
|
+ 'all',
|
|
|
+ [['all', 'Show All'], ['hide-all', 'Hide All'], ['only-polar', 'Only Polar']] as const,
|
|
|
+ { description: 'Determine 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' }),
|
|
|
+ ignoreLight: PD.Boolean(false, { description: 'Ignore light for stylized rendering of representations' }),
|
|
|
materialStyle: Material.getParam(),
|
|
|
clipObjects: PD.Group(Clip.Params),
|
|
|
interactions: PD.Group(InteractionsProvider.defaultParams, { label: 'Non-covalent Interactions' }),
|