Skip to content
Snippets Groups Projects
Commit 26345bfa authored by Alexander Rose's avatar Alexander Rose
Browse files

tweak

parent 8c9b8676
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment