UNPKG

molstar

Version:

A comprehensive macromolecular library.

21 lines (20 loc) 1.33 kB
/** * Copyright (c) 2018-2024 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { Geometry, GeometryUtils } from '../../mol-geo/geometry/geometry'; import { Representation } from '../representation'; import { Shape } from '../../mol-model/shape'; import { RuntimeContext } from '../../mol-task'; import { ParamDefinition as PD } from '../../mol-util/param-definition'; export interface ShapeRepresentation<D, G extends Geometry, P extends Geometry.Params<G>> extends Representation<D, P> { } export type ShapeGetter<D, G extends Geometry, P extends Geometry.Params<G>> = (ctx: RuntimeContext, data: D, props: PD.Values<P>, shape?: Shape<G>) => Shape<G> | Promise<Shape<G>>; export interface ShapeBuilder<G extends Geometry, P extends Geometry.Params<G>> { /** Hook to modify representation props */ modifyProps?: (props: Partial<PD.Values<P>>) => Partial<PD.Values<P>>; /** Hook to modify representation state */ modifyState?: (state: Partial<Representation.State>) => Partial<Representation.State>; } export declare function ShapeRepresentation<D, G extends Geometry, P extends Geometry.Params<G>>(getShape: ShapeGetter<D, G, P>, geometryUtils: GeometryUtils<G>, builder?: ShapeBuilder<G, P>): ShapeRepresentation<D, G, P>;