Browse Source

fix entity-source color showing black

- fixes #172
- now always using light-grey/white for regions with unkown source
Alexander Rose 3 years ago
parent
commit
eca052e52e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/mol-theme/color/entity-source.ts

+ 3 - 1
src/mol-theme/color/entity-source.ts

@@ -143,7 +143,9 @@ export function EntitySourceColorTheme(ctx: ThemeDataContext, props: PD.Values<E
             const seqToSrc = seqToSrcByModelEntity.get(mK);
             if (seqToSrc) {
                 // minus 1 to convert seqId to array index
-                return palette.color(seqToSrc[StructureProperties.residue.label_seq_id(location) - 1] - 1);
+                const src = seqToSrc[StructureProperties.residue.label_seq_id(location) - 1] - 1;
+                // check for -1 as not all sequence ids have a src given
+                return src === -1 ? DefaultColor : palette.color(src);
             } else {
                 return DefaultColor;
             }