mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 13:30:24 +08:00
fix multi-instance entity label display
- fix empty elements created in extendToAllInstances
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>');
|
||||
|
||||
Reference in New Issue
Block a user