diff --git a/src/mol-plugin/behavior/static/representation.ts b/src/mol-plugin/behavior/static/representation.ts index ee5c6a0e8343ee643070d580d1f3a282d54bffb4..29ba2871cff08c581a40b98a2555757fd7fe5b8c 100644 --- a/src/mol-plugin/behavior/static/representation.ts +++ b/src/mol-plugin/behavior/static/representation.ts @@ -18,6 +18,8 @@ export function SyncRepresentationToCanvas(ctx: PluginContext) { ctx.canvas3d.add(e.obj.data); ctx.canvas3d.requestDraw(true); + console.log(e.obj.data); + // TODO: update visiblity }); events.object.updated.subscribe(e => { diff --git a/src/mol-state/reducer.ts b/src/mol-state/reducer.ts new file mode 100644 index 0000000000000000000000000000000000000000..839dbddc6661da8f2ff5107266ad38c8c4ba7ad9 --- /dev/null +++ b/src/mol-state/reducer.ts @@ -0,0 +1,4 @@ +// TODO: state reducers +// The idea is to have "reduced"/computed objects from a state +// basicaly something like this Reduce(selection: StateSelection) => Value +// the reducer would be automatically called each time a state update is finished and any object of the selection is updated. \ No newline at end of file diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index dc7b6811161cbe369cb74dde2e49b29988e0b9a8..463dbcf151ad2405541189f4d65c63011a024a96 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -90,7 +90,17 @@ export namespace ParamDefinition { return { type: 'interval', label, description, defaultValue } } - export type Any = /* GenericValue<any> | */ Select<any> | MultiSelect<any> | Boolean | Range | Text | Color | Numeric | Interval + export interface Obj<P extends Params> extends Base<{ [K in keyof P]: P[K]['defaultValue']}> { + type: 'obj', + pivot?: keyof P, + params: P + } + export function Obj<P extends Params>(label: string, description: string, params: P, pivot?: keyof P): Obj<P> { + return { type: 'obj', label, description, defaultValue: getDefaultValues(params), params, pivot }; + } + + export type Any = Select<any> | MultiSelect<any> | Boolean | Range | Text | Color | Numeric | Interval | Obj<any> + export type Params = { [k: string]: Any } export type DefaultValues<T extends Params> = { [k in keyof T]: T[k]['defaultValue'] } @@ -117,7 +127,7 @@ export namespace ParamDefinition { definition?(a: A, globalCtx: Ctx): { [K in keyof P]?: Any }, /** Check the parameters and return a list of errors if the are not valid. */ validate?(params: P, a: A, globalCtx: unknown): ParamErrors | undefined, - /** Optional custom parameter equality. Use deep structural equal by default. */ + /** Optional custom parameter equality. Use shallow structural equal by default. */ areEqual?(oldParams: P, newParams: P): boolean } } \ No newline at end of file