Ver Fonte

fix complex-visual colorTheme.structure assignment

Alexander Rose há 6 anos atrás
pai
commit
9152c4e803

+ 0 - 1
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()

+ 2 - 0
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
 

+ 3 - 3
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)