From 9d0815a25887cce2e7cc3382433b5a43072e23da Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Wed, 13 Feb 2019 13:58:56 -0800 Subject: [PATCH] added fieldLabels to param defs --- src/mol-plugin/ui/controls/parameters.tsx | 6 +++--- src/mol-util/param-definition.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mol-plugin/ui/controls/parameters.tsx b/src/mol-plugin/ui/controls/parameters.tsx index 657d27676..99abe5c7d 100644 --- a/src/mol-plugin/ui/controls/parameters.tsx +++ b/src/mol-plugin/ui/controls/parameters.tsx @@ -344,9 +344,9 @@ export class Vec3Control extends React.PureComponent<ParamProps<PD.Vec3>, { isEx state = { isExpanded: false } components = { - 0: PD.Numeric(0, void 0, { label: 'X' }), - 1: PD.Numeric(0, void 0, { label: 'Y' }), - 2: PD.Numeric(0, void 0, { label: 'Z' }) + 0: PD.Numeric(0, void 0, { label: (this.props.param.fieldLabels && this.props.param.fieldLabels.x) || 'X' }), + 1: PD.Numeric(0, void 0, { label: (this.props.param.fieldLabels && this.props.param.fieldLabels.y) || 'Y' }), + 2: PD.Numeric(0, void 0, { label: (this.props.param.fieldLabels && this.props.param.fieldLabels.z) || 'Z' }) } change(value: PD.MultiSelect<any>['defaultValue']) { diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index 4fb2e52bf..46d8abbfe 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -14,13 +14,15 @@ export namespace ParamDefinition { export interface Info { label?: string, description?: string, + fieldLabels?: { [name: string]: string }, isHidden?: boolean, } function setInfo<T extends Info>(param: T, info?: Info): T { if (!info) return param; - if (info.description) param.description = info.description; if (info.label) param.label = info.label; + if (info.description) param.description = info.description; + if (info.fieldLabels) param.fieldLabels = info.fieldLabels; if (info.isHidden) param.isHidden = info.isHidden; return param; } -- GitLab