diff --git a/src/mol-geo/representation/structure/complex-representation.ts b/src/mol-geo/representation/structure/complex-representation.ts index 32d4816bf9e01e34c6188ba12d2f8c5c05ad461a..3e4b42416a1cd8eeca976a63039dd2fc6de31e01 100644 --- a/src/mol-geo/representation/structure/complex-representation.ts +++ b/src/mol-geo/representation/structure/complex-representation.ts @@ -10,7 +10,6 @@ import { Task } from 'mol-task' import { PickingId } from '../../util/picking'; import { Loci, EmptyLoci } from 'mol-model/loci'; import { MarkerAction } from '../../util/marker-data'; -import { getQualityProps } from '../util'; import { StructureProps, StructureRepresentation } from '.'; import { ComplexVisual } from './complex-visual'; @@ -19,7 +18,7 @@ export function ComplexRepresentation<P extends StructureProps>(label: string, v let _props: P function createOrUpdate(props: Partial<P> = {}, structure?: Structure) { - _props = Object.assign({}, _props, props, getQualityProps(props, structure)) + _props = Object.assign({}, _props, props) if (structure) _props.colorTheme.structure = structure return Task.create('Creating StructureRepresentation', async ctx => { diff --git a/src/mol-geo/representation/structure/representation/backbone.ts b/src/mol-geo/representation/structure/representation/backbone.ts index cb6c6f9d54cce679ab98ab76b7ee311d651c8528..6cd7425a269b485b5fed1f2695c7997908ebf859 100644 --- a/src/mol-geo/representation/structure/representation/backbone.ts +++ b/src/mol-geo/representation/structure/representation/backbone.ts @@ -11,6 +11,7 @@ import { Task } from 'mol-task'; import { Loci } from 'mol-model/loci'; import { MarkerAction } from '../../../util/marker-data'; import { PolymerBackboneVisual, DefaultPolymerBackboneProps } from '../visual/polymer-backbone-cylinder'; +import { getQualityProps } from '../../util'; export const DefaultBackboneProps = { ...DefaultPolymerBackboneProps @@ -32,7 +33,8 @@ export function BackboneRepresentation(): BackboneRepresentation { return { ...traceRepr.props } }, createOrUpdate: (props: Partial<BackboneProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultBackboneProps, props) + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultBackboneProps, currentProps, props, qualityProps) return Task.create('BackboneRepresentation', async ctx => { await traceRepr.createOrUpdate(currentProps, structure).runInContext(ctx) }) diff --git a/src/mol-geo/representation/structure/representation/ball-and-stick.ts b/src/mol-geo/representation/structure/representation/ball-and-stick.ts index 2c4bbceca2587dd2ae057ab59c7e6f66219ce844..e465f7ff4de5a6ba7a48e7450a2b2745adc9bc7c 100644 --- a/src/mol-geo/representation/structure/representation/ball-and-stick.ts +++ b/src/mol-geo/representation/structure/representation/ball-and-stick.ts @@ -14,6 +14,7 @@ import { Loci, isEmptyLoci } from 'mol-model/loci'; import { MarkerAction } from '../../../util/marker-data'; import { InterUnitLinkVisual } from '../visual/inter-unit-link-cylinder'; import { SizeThemeProps } from 'mol-view/theme/size'; +import { getQualityProps } from '../../util'; export const DefaultBallAndStickProps = { ...DefaultElementSphereProps, @@ -41,8 +42,9 @@ export function BallAndStickRepresentation(): BallAndStickRepresentation { return { ...elmementRepr.props, ...intraLinkRepr.props, ...interLinkRepr.props } }, createOrUpdate: (props: Partial<BallAndStickProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultBallAndStickProps, props) - return Task.create('DistanceRestraintRepresentation', async ctx => { + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultBallAndStickProps, currentProps, props, qualityProps) + return Task.create('BallAndStickRepresentation', async ctx => { await elmementRepr.createOrUpdate(currentProps, structure).runInContext(ctx) await intraLinkRepr.createOrUpdate(currentProps, structure).runInContext(ctx) await interLinkRepr.createOrUpdate(currentProps, structure).runInContext(ctx) diff --git a/src/mol-geo/representation/structure/representation/carbohydrate.ts b/src/mol-geo/representation/structure/representation/carbohydrate.ts index 1c5dc29226b18d543a4d354b0242010652882fad..cf39824fbbf238a94bb81323883a2cac7764a654 100644 --- a/src/mol-geo/representation/structure/representation/carbohydrate.ts +++ b/src/mol-geo/representation/structure/representation/carbohydrate.ts @@ -13,6 +13,7 @@ import { MarkerAction } from '../../../util/marker-data'; import { CarbohydrateSymbolVisual, DefaultCarbohydrateSymbolProps } from '../visual/carbohydrate-symbol-mesh'; import { CarbohydrateLinkVisual, DefaultCarbohydrateLinkProps } from '../visual/carbohydrate-link-cylinder'; import { SizeThemeProps } from 'mol-view/theme/size'; +import { getQualityProps } from '../../util'; export const DefaultCartoonProps = { ...DefaultCarbohydrateSymbolProps, @@ -38,7 +39,8 @@ export function CarbohydrateRepresentation(): CarbohydrateRepresentation { return { ...carbohydrateSymbolRepr.props, ...carbohydrateLinkRepr.props } }, createOrUpdate: (props: Partial<CarbohydrateProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultCartoonProps, props) + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultCartoonProps, currentProps, props, qualityProps) return Task.create('Creating CarbohydrateRepresentation', async ctx => { await carbohydrateSymbolRepr.createOrUpdate(currentProps, structure).runInContext(ctx) await carbohydrateLinkRepr.createOrUpdate(currentProps, structure).runInContext(ctx) diff --git a/src/mol-geo/representation/structure/representation/cartoon.ts b/src/mol-geo/representation/structure/representation/cartoon.ts index 9f503a09281ca30c30c706fa7bb5762c6956219f..7e42ec1155a6d4a80806a575dca6700bb08bab48 100644 --- a/src/mol-geo/representation/structure/representation/cartoon.ts +++ b/src/mol-geo/representation/structure/representation/cartoon.ts @@ -14,6 +14,7 @@ import { PolymerTraceVisual, DefaultPolymerTraceProps } from '../visual/polymer- import { PolymerGapVisual, DefaultPolymerGapProps } from '../visual/polymer-gap-cylinder'; import { NucleotideBlockVisual, DefaultNucleotideBlockProps } from '../visual/nucleotide-block-mesh'; import { SizeThemeProps } from 'mol-view/theme/size'; +import { getQualityProps } from '../../util'; // import { PolymerDirectionVisual, DefaultPolymerDirectionProps } from '../visual/polymer-direction-wedge'; export const DefaultCartoonProps = { @@ -46,7 +47,8 @@ export function CartoonRepresentation(): CartoonRepresentation { return { ...traceRepr.props, ...gapRepr.props, ...blockRepr.props } }, createOrUpdate: (props: Partial<CartoonProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultCartoonProps, props) + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultCartoonProps, currentProps, props, qualityProps) return Task.create('Creating CartoonRepresentation', async ctx => { await traceRepr.createOrUpdate(currentProps, structure).runInContext(ctx) await gapRepr.createOrUpdate(currentProps, structure).runInContext(ctx) diff --git a/src/mol-geo/representation/structure/representation/distance-restraint.ts b/src/mol-geo/representation/structure/representation/distance-restraint.ts index 2c61a224eb91cdd382f7ed90543be87b5c60813a..0a2d9c289a7d10b26741a7956380d802119d1e14 100644 --- a/src/mol-geo/representation/structure/representation/distance-restraint.ts +++ b/src/mol-geo/representation/structure/representation/distance-restraint.ts @@ -12,6 +12,7 @@ import { Loci } from 'mol-model/loci'; import { MarkerAction } from '../../../util/marker-data'; import { CrossLinkRestraintVisual, DefaultCrossLinkRestraintProps } from '../visual/cross-link-restraint-cylinder'; import { SizeThemeProps } from 'mol-view/theme/size'; +import { getQualityProps } from '../../util'; export const DefaultDistanceRestraintProps = { ...DefaultCrossLinkRestraintProps, @@ -34,7 +35,8 @@ export function DistanceRestraintRepresentation(): DistanceRestraintRepresentati return { ...crossLinkRepr.props } }, createOrUpdate: (props: Partial<DistanceRestraintProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultDistanceRestraintProps, props) + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultDistanceRestraintProps, currentProps, props, qualityProps) return Task.create('DistanceRestraintRepresentation', async ctx => { await crossLinkRepr.createOrUpdate(currentProps, structure).runInContext(ctx) }) diff --git a/src/mol-geo/representation/structure/representation/point.ts b/src/mol-geo/representation/structure/representation/point.ts index d9a2de382e53fdfe95c5d341db9c1ac70ca411ed..5c45a6ca12131e3e3e43982b002f95a5e1277d01 100644 --- a/src/mol-geo/representation/structure/representation/point.ts +++ b/src/mol-geo/representation/structure/representation/point.ts @@ -31,7 +31,7 @@ export function PointRepresentation(): PointRepresentation { return { ...pointRepr.props } }, createOrUpdate: (props: Partial<PointProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultPointProps, props) + currentProps = Object.assign({}, DefaultPointProps, currentProps, props) return pointRepr.createOrUpdate(currentProps, structure) }, getLoci: (pickingId: PickingId) => { diff --git a/src/mol-geo/representation/structure/representation/spacefill.ts b/src/mol-geo/representation/structure/representation/spacefill.ts index 3553349326afe74d81f52435ca8812850e31e04e..ee18231d9462c62333031fadaaa8a471e1adeb99 100644 --- a/src/mol-geo/representation/structure/representation/spacefill.ts +++ b/src/mol-geo/representation/structure/representation/spacefill.ts @@ -11,6 +11,7 @@ import { Structure } from 'mol-model/structure'; import { PickingId } from '../../../util/picking'; import { MarkerAction } from '../../../util/marker-data'; import { Loci } from 'mol-model/loci'; +import { getQualityProps } from '../../util'; export const DefaultSpacefillProps = { ...DefaultElementSphereProps @@ -31,7 +32,8 @@ export function SpacefillRepresentation(): SpacefillRepresentation { return { ...sphereRepr.props } }, createOrUpdate: (props: Partial<SpacefillProps> = {}, structure?: Structure) => { - currentProps = Object.assign({}, DefaultSpacefillProps, props) + const qualityProps = getQualityProps(Object.assign({}, currentProps, props), structure) + currentProps = Object.assign({}, DefaultSpacefillProps, currentProps, props, qualityProps) return sphereRepr.createOrUpdate(currentProps, structure) }, getLoci: (pickingId: PickingId) => { diff --git a/src/mol-geo/representation/structure/units-representation.ts b/src/mol-geo/representation/structure/units-representation.ts index d88f68cb0c580cf287539fbe6056eae994db7740..766845896c9f491b0a225218409ab9512bdf9a8c 100644 --- a/src/mol-geo/representation/structure/units-representation.ts +++ b/src/mol-geo/representation/structure/units-representation.ts @@ -12,7 +12,6 @@ import { Representation, RepresentationProps, Visual } from '..'; import { PickingId } from '../../util/picking'; import { Loci, EmptyLoci, isEmptyLoci } from 'mol-model/loci'; import { MarkerAction } from '../../util/marker-data'; -import { getQualityProps } from '../util'; import { StructureProps } from '.'; import { StructureGroup } from './units-visual'; @@ -29,8 +28,7 @@ export function UnitsRepresentation<P extends StructureProps>(label: string, vis let _groups: ReadonlyArray<Unit.SymmetryGroup> function createOrUpdate(props: Partial<P> = {}, structure?: Structure) { - console.log(props) - _props = Object.assign({}, _props, props, getQualityProps(props, structure)) + _props = Object.assign({}, _props, props) return Task.create('Creating or updating StructureRepresentation', async ctx => { if (!_structure && !structure) { diff --git a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts index 50b85fb4da1223a8ba6ec89b97f9b2b1ba2af306..309319c00520fff4fbe60e499c787db5a19e717c 100644 --- a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts +++ b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts @@ -5,7 +5,7 @@ */ import { Unit, Structure, StructureElement } from 'mol-model/structure'; -import { ComplexVisual } from '..'; +import { ComplexVisual, MeshUpdateState } from '..'; import { RuntimeContext } from 'mol-task' import { Mesh } from '../../../mesh/mesh'; import { PickingId } from '../../../util/picking'; @@ -154,7 +154,9 @@ export function CarbohydrateSymbolVisual(): ComplexVisual<CarbohydrateSymbolProp createLocationIterator: CarbohydrateElementIterator, getLoci: getCarbohydrateLoci, mark: markCarbohydrate, - setUpdateState: () => {} + setUpdateState: (state: MeshUpdateState, newProps: CarbohydrateSymbolProps, currentProps: CarbohydrateSymbolProps) => { + state.createMesh = newProps.detail !== currentProps.detail + } }) } diff --git a/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts b/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts index f5934887e2d1b7ad553c3a252a33cea1f92f863e..66c2817fd01f326ee6dc36403768f27b0418a69c 100644 --- a/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/intra-unit-link-cylinder.ts @@ -6,7 +6,7 @@ */ import { Unit, Link, StructureElement } from 'mol-model/structure'; -import { UnitsVisual } from '..'; +import { UnitsVisual, MeshUpdateState } from '..'; import { RuntimeContext } from 'mol-task' import { DefaultLinkCylinderProps, LinkCylinderProps, createLinkCylinderMesh, LinkIterator } from './util/link'; import { Mesh } from '../../../mesh/mesh'; @@ -77,7 +77,9 @@ export function IntraUnitLinkVisual(): UnitsVisual<IntraUnitLinkProps> { createLocationIterator: LinkIterator.fromGroup, getLoci: getLinkLoci, mark: markLink, - setUpdateState: () => {} + setUpdateState: (state: MeshUpdateState, newProps: LinkCylinderProps, currentProps: LinkCylinderProps) => { + state.createMesh = newProps.radialSegments !== currentProps.radialSegments + } }) } diff --git a/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts b/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts index 8c848a8cb0fa7107fcfab1fa0762eee089207552..fb3521a29f0de78be028ff18880f1bfedb401c6b 100644 --- a/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts @@ -5,7 +5,7 @@ */ import { Unit } from 'mol-model/structure'; -import { UnitsVisual } from '..'; +import { UnitsVisual, MeshUpdateState } from '..'; import { RuntimeContext } from 'mol-task' import { Mesh } from '../../../mesh/mesh'; import { MeshBuilder } from '../../../mesh/mesh-builder'; @@ -77,6 +77,8 @@ export function PolymerBackboneVisual(): UnitsVisual<PolymerBackboneProps> { createLocationIterator: StructureElementIterator.fromGroup, getLoci: getElementLoci, mark: markElement, - setUpdateState: () => {} + setUpdateState: (state: MeshUpdateState, newProps: PolymerBackboneProps, currentProps: PolymerBackboneProps) => { + state.createMesh = newProps.radialSegments !== currentProps.radialSegments + } }) } \ No newline at end of file diff --git a/src/mol-geo/representation/structure/visual/polymer-gap-cylinder.ts b/src/mol-geo/representation/structure/visual/polymer-gap-cylinder.ts index 05a945cbac15070d998eab48b540f1f3483200f9..3c7afa8028f1b9c1361eee3a885f8e9d95c2a8bb 100644 --- a/src/mol-geo/representation/structure/visual/polymer-gap-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/polymer-gap-cylinder.ts @@ -5,7 +5,7 @@ */ import { Unit } from 'mol-model/structure'; -import { UnitsVisual } from '..'; +import { UnitsVisual, MeshUpdateState } from '..'; import { RuntimeContext } from 'mol-task' import { Mesh } from '../../../mesh/mesh'; import { MeshBuilder } from '../../../mesh/mesh-builder'; @@ -85,6 +85,8 @@ export function PolymerGapVisual(): UnitsVisual<PolymerGapProps> { createLocationIterator: PolymerGapLocationIterator.fromGroup, getLoci: getElementLoci, mark: markElement, - setUpdateState: () => {} + setUpdateState: (state: MeshUpdateState, newProps: PolymerGapProps, currentProps: PolymerGapProps) => { + state.createMesh = newProps.radialSegments !== currentProps.radialSegments + } }) } \ No newline at end of file