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

fix multi-instance entity label display

- fix empty elements created in extendToAllInstances
parent 582a0e2a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
/**
* 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,8 +497,10 @@ export namespace Loci {
if (!elementIndices) continue;
const indices = getUnitIndices(unit.elements, elementIndices);
if (OrderedSet.size(indices)) {
elements[elements.length] = { unit, indices };
}
}
return Loci(loci.structure, elements);
}
......
/**
* 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];
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(', ');
label.push(name);
entityNames.add(name);
}
if (entityNames.size === 1) entityNames.forEach(name => label.push(name));
}
label.push(lociLabel(loci));
return label.filter(l => !!l).join('</br>');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment