From 9152c4e8031938f1ac772570216455c7819ef097 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Thu, 6 Sep 2018 12:30:26 -0700 Subject: [PATCH] fix complex-visual colorTheme.structure assignment --- .../representation/structure/complex-representation.ts | 1 - src/mol-geo/representation/structure/complex-visual.ts | 2 ++ .../representation/structure/representation/carbohydrate.ts | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mol-geo/representation/structure/complex-representation.ts b/src/mol-geo/representation/structure/complex-representation.ts index 3e4b42416..a5e9f3aac 100644 --- a/src/mol-geo/representation/structure/complex-representation.ts +++ b/src/mol-geo/representation/structure/complex-representation.ts @@ -19,7 +19,6 @@ export function ComplexRepresentation<P extends StructureProps>(label: string, v function createOrUpdate(props: Partial<P> = {}, structure?: Structure) { _props = Object.assign({}, _props, props) - if (structure) _props.colorTheme.structure = structure return Task.create('Creating StructureRepresentation', async ctx => { if (!visual) visual = visualCtor() diff --git a/src/mol-geo/representation/structure/complex-visual.ts b/src/mol-geo/representation/structure/complex-visual.ts index b53af777d..179b9803d 100644 --- a/src/mol-geo/representation/structure/complex-visual.ts +++ b/src/mol-geo/representation/structure/complex-visual.ts @@ -48,6 +48,7 @@ export function ComplexMeshVisual<P extends ComplexMeshProps>(builder: ComplexMe async function create(ctx: RuntimeContext, structure: Structure, props: Partial<P> = {}) { currentProps = Object.assign({}, defaultProps, props) + currentProps.colorTheme.structure = structure currentStructure = structure conformationHash = Structure.conformationHash(currentStructure) @@ -59,6 +60,7 @@ export function ComplexMeshVisual<P extends ComplexMeshProps>(builder: ComplexMe async function update(ctx: RuntimeContext, props: Partial<P>) { const newProps = Object.assign({}, currentProps, props) + newProps.colorTheme.structure = currentStructure if (!renderObject) return false diff --git a/src/mol-geo/representation/structure/representation/carbohydrate.ts b/src/mol-geo/representation/structure/representation/carbohydrate.ts index cf39824fb..e1f6d9da0 100644 --- a/src/mol-geo/representation/structure/representation/carbohydrate.ts +++ b/src/mol-geo/representation/structure/representation/carbohydrate.ts @@ -15,13 +15,13 @@ import { CarbohydrateLinkVisual, DefaultCarbohydrateLinkProps } from '../visual/ import { SizeThemeProps } from 'mol-view/theme/size'; import { getQualityProps } from '../../util'; -export const DefaultCartoonProps = { +export const DefaultCarbohydrateProps = { ...DefaultCarbohydrateSymbolProps, ...DefaultCarbohydrateLinkProps, sizeTheme: { name: 'uniform', value: 1, factor: 1 } as SizeThemeProps, } -export type CarbohydrateProps = typeof DefaultCartoonProps +export type CarbohydrateProps = typeof DefaultCarbohydrateProps export type CarbohydrateRepresentation = StructureRepresentation<CarbohydrateProps> @@ -40,7 +40,7 @@ export function CarbohydrateRepresentation(): CarbohydrateRepresentation { }, createOrUpdate: (props: Partial<CarbohydrateProps> = {}, structure?: Structure) => { const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) - currentProps = Object.assign({}, DefaultCartoonProps, currentProps, props, qualityProps) + currentProps = Object.assign({}, DefaultCarbohydrateProps, currentProps, props, qualityProps) return Task.create('Creating CarbohydrateRepresentation', async ctx => { await carbohydrateSymbolRepr.createOrUpdate(currentProps, structure).runInContext(ctx) await carbohydrateLinkRepr.createOrUpdate(currentProps, structure).runInContext(ctx) -- GitLab