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

wip, clone params

parent 143ccd41
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ export const BallAndStickParams = { ...@@ -38,7 +38,7 @@ export const BallAndStickParams = {
} }
export type BallAndStickParams = typeof BallAndStickParams export type BallAndStickParams = typeof BallAndStickParams
export function getBallAndStickParams(ctx: ThemeRegistryContext, structure: Structure) { export function getBallAndStickParams(ctx: ThemeRegistryContext, structure: Structure) {
return BallAndStickParams // TODO return copy return PD.clone(BallAndStickParams)
} }
export type BallAndStickRepresentation = StructureRepresentation<BallAndStickParams> export type BallAndStickRepresentation = StructureRepresentation<BallAndStickParams>
......
...@@ -38,7 +38,7 @@ export const CartoonParams = { ...@@ -38,7 +38,7 @@ export const CartoonParams = {
} }
export type CartoonParams = typeof CartoonParams export type CartoonParams = typeof CartoonParams
export function getCartoonParams(ctx: ThemeRegistryContext, structure: Structure) { export function getCartoonParams(ctx: ThemeRegistryContext, structure: Structure) {
return CartoonParams // TODO return copy return PD.clone(CartoonParams)
} }
export type CartoonRepresentation = StructureRepresentation<CartoonParams> export type CartoonRepresentation = StructureRepresentation<CartoonParams>
......
...@@ -161,7 +161,7 @@ export const DirectVolumeParams = { ...@@ -161,7 +161,7 @@ export const DirectVolumeParams = {
} }
export type DirectVolumeParams = typeof DirectVolumeParams export type DirectVolumeParams = typeof DirectVolumeParams
export function getDirectVolumeParams(ctx: ThemeRegistryContext, volume: VolumeData) { export function getDirectVolumeParams(ctx: ThemeRegistryContext, volume: VolumeData) {
return DirectVolumeParams // TODO return copy return PD.clone(DirectVolumeParams)
} }
export function DirectVolumeVisual(): VolumeVisual<DirectVolumeParams> { export function DirectVolumeVisual(): VolumeVisual<DirectVolumeParams> {
......
...@@ -46,7 +46,7 @@ export const IsosurfaceParams = { ...@@ -46,7 +46,7 @@ export const IsosurfaceParams = {
} }
export type IsosurfaceParams = typeof IsosurfaceParams export type IsosurfaceParams = typeof IsosurfaceParams
export function getIsosurfaceParams(ctx: ThemeRegistryContext, volume: VolumeData) { export function getIsosurfaceParams(ctx: ThemeRegistryContext, volume: VolumeData) {
return IsosurfaceParams // TODO return copy return PD.clone(IsosurfaceParams)
} }
export function IsosurfaceVisual(): VolumeVisual<IsosurfaceParams> { export function IsosurfaceVisual(): VolumeVisual<IsosurfaceParams> {
......
...@@ -145,8 +145,6 @@ export const VolumeParams = { ...@@ -145,8 +145,6 @@ export const VolumeParams = {
isoValueRelative: PD.Range('Iso Value Relative', '', 2, -10, 10, 0.1), isoValueRelative: PD.Range('Iso Value Relative', '', 2, -10, 10, 0.1),
} }
export type VolumeParams = typeof VolumeParams export type VolumeParams = typeof VolumeParams
// export const DefaultVolumeProps = PD.getDefaultValues(VolumeParams)
// export type VolumeProps = typeof DefaultVolumeProps
export function VolumeRepresentation<P extends VolumeParams>(label: string, getParams: RepresentationParamsGetter<VolumeData, P>, visualCtor: (volume: VolumeData) => VolumeVisual<P>): VolumeRepresentation<P> { export function VolumeRepresentation<P extends VolumeParams>(label: string, getParams: RepresentationParamsGetter<VolumeData, P>, visualCtor: (volume: VolumeData) => VolumeVisual<P>): VolumeRepresentation<P> {
let visual: VolumeVisual<P> let visual: VolumeVisual<P>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
import { Color as ColorData } from './color'; import { Color as ColorData } from './color';
import { shallowClone } from 'mol-util';
export namespace ParamDefinition { export namespace ParamDefinition {
export interface Base<T> { export interface Base<T> {
...@@ -98,4 +99,8 @@ export namespace ParamDefinition { ...@@ -98,4 +99,8 @@ export namespace ParamDefinition {
Object.keys(params).forEach(k => d[k] = params[k].defaultValue) Object.keys(params).forEach(k => d[k] = params[k].defaultValue)
return d as DefaultValues<T> return d as DefaultValues<T>
} }
export function clone<P extends Params>(params: P): P {
return shallowClone(params)
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment