ソースを参照

stats: count single element unit as unit not element

Alexander Rose 5 年 前
コミット
70cc3a612e
1 ファイル変更7 行追加6 行削除
  1. 7 6
      src/mol-model/structure/structure/element/stats.ts

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

@@ -63,16 +63,17 @@ export namespace Stats {
             Location.set(stats.firstElementLoc, unit, elements[OrderedSet.start(indices)])
         }
 
-        if (size === 1) {
-            stats.elementCount += 1
-            if (stats.elementCount === 1) {
-                Location.set(stats.firstElementLoc, unit, elements[OrderedSet.start(indices)])
-            }
-        } else if (size === elements.length) {
+        // count single element unit as unit not element
+        if (size === elements.length) {
             stats.unitCount += 1
             if (stats.unitCount === 1) {
                 Location.set(stats.firstUnitLoc, unit, elements[OrderedSet.start(indices)])
             }
+        } else if (size === 1) {
+            stats.elementCount += 1
+            if (stats.elementCount === 1) {
+                Location.set(stats.firstElementLoc, unit, elements[OrderedSet.start(indices)])
+            }
         } else {
             if (Unit.isAtomic(unit)) {
                 const { index, offsets } = unit.model.atomicHierarchy.residueAtomSegments