瀏覽代碼

fix entity-source color showing black

- fixes #172
- now always using light-grey/white for regions with unkown source
Alexander Rose 3 年之前
父節點
當前提交
eca052e52e
共有 1 個文件被更改,包括 3 次插入1 次删除
  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;
             }