Skip to content
Snippets Groups Projects
Commit ea2b12fb authored by Alexander Rose's avatar Alexander Rose
Browse files

tweaked default color for coarse spheres

parent 7edac179
No related branches found
No related tags found
No related merge requests found
......@@ -150,6 +150,8 @@ type cifVariants = 'dscif' | -1
export function guessCifVariant(info: FileInfo, data: Uint8Array | string): cifVariants {
if (info.ext === 'bcif') {
try {
// TODO find a way to run msgpackDecode only once
// now it is run twice, here and during file parsing
if (msgpackDecode(data as Uint8Array).encoder.startsWith('VolumeServer')) return 'dscif'
} catch { }
} else if (info.ext === 'cif') {
......
......@@ -228,7 +228,7 @@ export function complexRepresentation(
if (!params || !params.hideCoarse) {
root.apply(StateTransforms.Model.StructureComplexElement, { type: 'spheres' })
.apply(StateTransforms.Representation.StructureRepresentation3D,
StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'spacefill'));
StructureRepresentation3DHelpers.getDefaultParamsStatic(ctx, 'spacefill', {}, 'polymer-id'));
}
}
......
......@@ -108,13 +108,14 @@ namespace StructureRepresentation3DHelpers {
})
}
export function getDefaultParamsStatic(ctx: PluginContext, name: BuiltInStructureRepresentationsName, structureParams?: Partial<PD.Values<StructureParams>>): StateTransformer.Params<StructureRepresentation3D> {
export function getDefaultParamsStatic(ctx: PluginContext, name: BuiltInStructureRepresentationsName, structureParams?: Partial<PD.Values<StructureParams>>, colorName?: BuiltInColorThemeName): StateTransformer.Params<StructureRepresentation3D> {
const type = ctx.structureRepresentation.registry.get(name);
const colorParams = ctx.structureRepresentation.themeCtx.colorThemeRegistry.get(type.defaultColorTheme).defaultValues;
const color = colorName || type.defaultColorTheme;
const colorParams = ctx.structureRepresentation.themeCtx.colorThemeRegistry.get(color).defaultValues;
const sizeParams = ctx.structureRepresentation.themeCtx.sizeThemeRegistry.get(type.defaultSizeTheme).defaultValues
return ({
type: { name, params: structureParams ? { ...type.defaultValues, ...structureParams } : type.defaultValues },
colorTheme: { name: type.defaultColorTheme, params: colorParams },
colorTheme: { name: color, params: colorParams },
sizeTheme: { name: type.defaultSizeTheme, params: sizeParams }
})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment