diff --git a/CHANGELOG.md b/CHANGELOG.md index 28d051aa7b6b5b422fd4586fd8fa4714774bca71..2c81e8913a136d3ec224b17effaafda58ba874d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Note that since we don't clearly distinguish between a public and private interf ## [Unreleased] - Fix color smoothing of elongated structures (by fixing ``Sphere.expand`` for spheres with highly directional extrema) +- Fix entity label not displayed when multiple instances of the same entity are highlighted +- Fix empty elements created in ``StructureElement.Loci.extendToAllInstances`` ## [v3.0.1] - 2022-01-27 diff --git a/src/mol-model/structure/structure/element/loci.ts b/src/mol-model/structure/structure/element/loci.ts index 53c2780c60f4191ab4300bb880b507b9ee490370..e920a09298eebba9c8d85640355842cf7c0a8e5d 100644 --- a/src/mol-model/structure/structure/element/loci.ts +++ b/src/mol-model/structure/structure/element/loci.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2017-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> @@ -497,7 +497,9 @@ export namespace Loci { if (!elementIndices) continue; const indices = getUnitIndices(unit.elements, elementIndices); - elements[elements.length] = { unit, indices }; + if (OrderedSet.size(indices)) { + elements[elements.length] = { unit, indices }; + } } return Loci(loci.structure, elements); diff --git a/src/mol-plugin/behavior/dynamic/representation.ts b/src/mol-plugin/behavior/dynamic/representation.ts index 2ab509a86294d3d88cefa66b2d4fc0c996d8702c..11fe074c1ff7c5d4452a81536bf0f62776383db0 100644 --- a/src/mol-plugin/behavior/dynamic/representation.ts +++ b/src/mol-plugin/behavior/dynamic/representation.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-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> @@ -212,11 +212,14 @@ export const DefaultLociLabelProvider = PluginBehavior.create({ private f = { label: (loci: Loci) => { const label: string[] = []; - if (StructureElement.Loci.is(loci) && loci.elements.length === 1) { - const { unit: u } = loci.elements[0]; - const l = StructureElement.Location.create(loci.structure, u, u.elements[0]); - const name = StructureProperties.entity.pdbx_description(l).join(', '); - label.push(name); + if (StructureElement.Loci.is(loci)) { + const entityNames = new Set<string>(); + for (const { unit: u } of loci.elements) { + const l = StructureElement.Location.create(loci.structure, u, u.elements[0]); + const name = StructureProperties.entity.pdbx_description(l).join(', '); + entityNames.add(name); + } + if (entityNames.size === 1) entityNames.forEach(name => label.push(name)); } label.push(lociLabel(loci)); return label.filter(l => !!l).join('</br>');