Ver Fonte

updated the default color palette and removed the redundant model color map

Jason Pattle há 2 anos atrás
pai
commit
6cbed80815
1 ficheiros alterados com 3 adições e 8 exclusões
  1. 3 8
      src/mol-theme/color/model-index.ts

+ 3 - 8
src/mol-theme/color/model-index.ts

@@ -17,7 +17,7 @@ const DefaultColor = Color(0xCCCCCC);
 const Description = 'Gives every model a unique color based on the position (index) of the model in the list of models in the structure.';
 
 export const ModelIndexColorThemeParams = {
-    ...getPaletteParams({ type: 'colors', colorList: 'purples' }),
+    ...getPaletteParams({ type: 'colors', colorList: 'many-distinct' }),
 };
 export type ModelIndexColorThemeParams = typeof ModelIndexColorThemeParams
 export function getModelIndexColorThemeParams(ctx: ThemeDataContext) {
@@ -35,17 +35,12 @@ export function ModelIndexColorTheme(ctx: ThemeDataContext, props: PD.Values<Mod
 
         const palette = getPalette(size, props);
         legend = palette.legend;
-        const modelColor = new Map<number, Color>();
-        for (let i = 0, il = models.length; i < il; ++i) {
-            const idx = Model.Index.get(models[i])?.value || 0;
-            modelColor.set(idx, palette.color(idx));
-        }
 
         color = (location: Location): Color => {
             if (StructureElement.Location.is(location)) {
-                return modelColor.get(Model.Index.get(location.unit.model).value || 0)!;
+                return palette.color(Model.Index.get(location.unit.model).value || 0)!;
             } else if (Bond.isLocation(location)) {
-                return modelColor.get(Model.Index.get(location.aUnit.model).value || 0)!;
+                return palette.color(Model.Index.get(location.aUnit.model).value || 0)!;
             }
             return DefaultColor;
         };