From 26345bfa50c2e25575229be5f74490baac13c812 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sun, 16 Oct 2022 17:25:44 -0700 Subject: [PATCH] tweak --- .../behavior/dynamic/custom-props/structure-info.ts | 6 ++++-- src/mol-theme/color/model-index.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts b/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts index a0a8db2f3..f144a40cf 100644 --- a/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts +++ b/src/mol-plugin/behavior/dynamic/custom-props/structure-info.ts @@ -53,12 +53,14 @@ export const StructureInfo = PluginBehavior.create({ } private setModelMaxIndex() { - const maxIndex = this.maxModelIndex; + const value = this.maxModelIndex; const cells = this.ctx.state.data.select(StateSelection.Generators.rootsOfType(PluginStateObject.Molecule.Model)); for (const c of cells) { const m = c.obj?.data; if (m) { - Model.MaxIndex.set(m, { value: maxIndex }, maxIndex); + if (Model.MaxIndex.get(m).value !== value) { + Model.MaxIndex.set(m, { value }, value); + } } } } diff --git a/src/mol-theme/color/model-index.ts b/src/mol-theme/color/model-index.ts index db65a343a..cbdfd683f 100644 --- a/src/mol-theme/color/model-index.ts +++ b/src/mol-theme/color/model-index.ts @@ -31,7 +31,7 @@ export function ModelIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<Mod if (ctx.structure) { // max-index is the same for all models - const size = (Model.MaxIndex.get(ctx.structure.models[0])?.value || -1) + 1; + const size = (Model.MaxIndex.get(ctx.structure.models[0]).value ?? -1) + 1; const palette = getPalette(size, props); legend = palette.legend; -- GitLab