From 07eb829f6249f489dc241c6c74fdbcea83870425 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alex.rose@rcsb.org>
Date: Tue, 4 Sep 2018 15:32:55 -0700
Subject: [PATCH] better default props handling

---
 .../representation/structure/complex-representation.ts     | 4 ++--
 .../representation/structure/representation/point.ts       | 3 ---
 .../representation/structure/units-representation.ts       | 7 ++++---
 .../representation/structure/visual/element-point.ts       | 4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/mol-geo/representation/structure/complex-representation.ts b/src/mol-geo/representation/structure/complex-representation.ts
index 6053df8f3..32d4816bf 100644
--- a/src/mol-geo/representation/structure/complex-representation.ts
+++ b/src/mol-geo/representation/structure/complex-representation.ts
@@ -11,7 +11,7 @@ import { PickingId } from '../../util/picking';
 import { Loci, EmptyLoci } from 'mol-model/loci';
 import { MarkerAction } from '../../util/marker-data';
 import { getQualityProps } from '../util';
-import { StructureProps, DefaultStructureProps, StructureRepresentation } from '.';
+import { StructureProps, StructureRepresentation } from '.';
 import { ComplexVisual } from './complex-visual';
 
 export function ComplexRepresentation<P extends StructureProps>(label: string, visualCtor: () => ComplexVisual<P>): StructureRepresentation<P> {
@@ -19,7 +19,7 @@ export function ComplexRepresentation<P extends StructureProps>(label: string, v
     let _props: P
 
     function createOrUpdate(props: Partial<P> = {}, structure?: Structure) {
-        _props = Object.assign({}, DefaultStructureProps, _props, props, getQualityProps(props, structure))
+        _props = Object.assign({}, _props, props, getQualityProps(props, structure))
         if (structure) _props.colorTheme.structure = structure
 
         return Task.create('Creating StructureRepresentation', async ctx => {
diff --git a/src/mol-geo/representation/structure/representation/point.ts b/src/mol-geo/representation/structure/representation/point.ts
index 892ffa0c2..5a3e60475 100644
--- a/src/mol-geo/representation/structure/representation/point.ts
+++ b/src/mol-geo/representation/structure/representation/point.ts
@@ -7,12 +7,9 @@
 import { UnitsRepresentation } from '..';
 import { ElementPointVisual, DefaultElementPointProps } from '../visual/element-point';
 import { StructureRepresentation } from '../units-representation';
-import { SizeThemeProps } from 'mol-view/theme/size';
 
 export const DefaultPointProps = {
     ...DefaultElementPointProps,
-
-    sizeTheme: { name: 'uniform', value: 0.2 } as SizeThemeProps,
 }
 export type PointProps = typeof DefaultPointProps
 
diff --git a/src/mol-geo/representation/structure/units-representation.ts b/src/mol-geo/representation/structure/units-representation.ts
index 8f9f05ff1..17f85e2f6 100644
--- a/src/mol-geo/representation/structure/units-representation.ts
+++ b/src/mol-geo/representation/structure/units-representation.ts
@@ -13,14 +13,14 @@ import { PickingId } from '../../util/picking';
 import { Loci, EmptyLoci, isEmptyLoci } from 'mol-model/loci';
 import { MarkerAction } from '../../util/marker-data';
 import { getQualityProps } from '../util';
-import { DefaultStructureProps, StructureProps } from '.';
+import { StructureProps } from '.';
 
 export interface UnitsVisual<P extends RepresentationProps = {}> extends Visual<Unit.SymmetryGroup, P> { }
 export interface  StructureVisual<P extends RepresentationProps = {}> extends Visual<Structure, P> { }
 
 export interface StructureRepresentation<P extends RepresentationProps = {}> extends Representation<Structure, P> { }
 
-export function UnitsRepresentation<P extends StructureProps>(visualCtor: () => UnitsVisual<P>): StructureRepresentation<P> {
+export function UnitsRepresentation<P extends StructureProps>(label: string, visualCtor: () => UnitsVisual<P>): StructureRepresentation<P> {
     let visuals = new Map<number, { group: Unit.SymmetryGroup, visual: UnitsVisual<P> }>()
 
     let _props: P
@@ -28,7 +28,7 @@ export function UnitsRepresentation<P extends StructureProps>(visualCtor: () =>
     let _groups: ReadonlyArray<Unit.SymmetryGroup>
 
     function createOrUpdate(props: Partial<P> = {}, structure?: Structure) {
-        _props = Object.assign({}, DefaultStructureProps, _props, props, getQualityProps(props, structure))
+        _props = Object.assign({}, _props, props, getQualityProps(props, structure))
         _props.colorTheme.structure = structure
 
         return Task.create('Creating or updating StructureRepresentation', async ctx => {
@@ -120,6 +120,7 @@ export function UnitsRepresentation<P extends StructureProps>(visualCtor: () =>
     }
 
     return {
+        label,
         get renderObjects() {
             const renderObjects: RenderObject[] = []
             visuals.forEach(({ visual }) => {
diff --git a/src/mol-geo/representation/structure/visual/element-point.ts b/src/mol-geo/representation/structure/visual/element-point.ts
index 549ff4aab..924db42c3 100644
--- a/src/mol-geo/representation/structure/visual/element-point.ts
+++ b/src/mol-geo/representation/structure/visual/element-point.ts
@@ -25,7 +25,8 @@ import { createTransforms } from '../../../util/transform-data';
 
 export const DefaultElementPointProps = {
     ...DefaultStructureProps,
-    sizeTheme: { name: 'physical' } as SizeThemeProps,
+
+    sizeTheme: { name: 'uniform', value: 0.2 } as SizeThemeProps,
     pointSizeAttenuation: true,
 }
 export type ElementPointProps = Partial<typeof DefaultElementPointProps>
@@ -75,7 +76,6 @@ export function ElementPointVisual(): UnitsVisual<ElementPointProps> {
                 vertices = await createElementPointVertices(ctx, unit, vertices)
 
                 renderObject = await createUnitsPointRenderObject(ctx, group, vertices, locationIt, currentProps)
-                console.log(renderObject)
             } else if (renderObject) {
                 if (group) currentGroup = group
 
-- 
GitLab