Browse Source

fixed labels for MultiChain units

Alexander Rose 5 years ago
parent
commit
97ebb2dccc
2 changed files with 10 additions and 4 deletions
  1. 7 3
      src/mol-model/structure/structure/element/stats.ts
  2. 3 1
      src/mol-theme/label.ts

+ 7 - 3
src/mol-model/structure/structure/element/stats.ts

@@ -71,9 +71,13 @@ export namespace Stats {
                 Location.set(stats.firstUnitLoc, structure, unit, elements[OrderedSet.start(indices)])
             }
         } else if (size === 1) {
-            stats.elementCount += 1
-            if (stats.elementCount === 1) {
-                Location.set(stats.firstElementLoc, structure, unit, elements[OrderedSet.start(indices)])
+            if (Unit.Traits.is(unit.traits, Unit.Trait.MultiChain)) {
+                return
+            } else {
+                stats.elementCount += 1
+                if (stats.elementCount === 1) {
+                    Location.set(stats.firstElementLoc, structure, unit, elements[OrderedSet.start(indices)])
+                }
             }
         } else {
             if (Unit.isAtomic(unit)) {

+ 3 - 1
src/mol-theme/label.ts

@@ -80,7 +80,9 @@ function _structureElementStatsLabel(stats: StructureElement.Stats, countsOnly =
         return elementLabel(stats.firstResidueLoc, { hidePrefix, condensed, granularity: 'residue', reverse })
     } else if (!countsOnly && elementCount === 0 && residueCount === 0 && chainCount === 1) {
         const { unit } = stats.firstChainLoc
-        const granularity = (Unit.isAtomic(unit) && getResidueCount(unit) === 1) ? 'residue' : 'chain'
+        const granularity = (Unit.isAtomic(unit) && getResidueCount(unit) === 1)
+            ? 'residue' : Unit.Traits.is(unit.traits, Unit.Trait.MultiChain)
+                ? 'residue' : 'chain'
         return elementLabel(stats.firstChainLoc, { hidePrefix, condensed, granularity, reverse })
     } else if (!countsOnly) {
         const label: string[] = []