Browse Source

elementLabel edgecase

David Sehnal 4 years ago
parent
commit
b159752b72
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/mol-theme/label.ts

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

@@ -203,7 +203,8 @@ export function _bundleLabel(bundle: Loci.Bundle<any>, options: LabelOptions) {
 export function elementLabel(location: StructureElement.Location, options: Partial<LabelOptions> = {}): string {
     const o = { ...DefaultLabelOptions, ...options };
     const _label = _elementLabel(location, o.granularity, o.hidePrefix, o.reverse || o.condensed);
-    const label = o.condensed ? _label[0].replace(/\[.*\]/g, '').trim() : _label.filter(l => !!l).join(' | ');
+    // TODO: condensed label for single atom structure returns empty label.. handle this case here?
+    const label = o.condensed ? _label[0]?.replace(/\[.*\]/g, '').trim() ?? '' : _label.filter(l => !!l).join(' | ');
     return o.htmlStyling ? label : stripTags(label);
 }