molstar
Version:
A comprehensive macromolecular library.
35 lines (34 loc) • 1.72 kB
JavaScript
/**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { __assign } from "tslib";
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
import { StructureRepresentationProvider, StructureRepresentationStateBuilder, ComplexRepresentation } from '../representation';
import { Representation } from '../../../mol-repr/representation';
import { LabelTextVisual, LabelTextParams } from '../visual/label-text';
import { MarkerAction } from '../../../mol-util/marker-action';
var LabelVisuals = {
'label-text': function (ctx, getParams) { return ComplexRepresentation('Label text', ctx, getParams, LabelTextVisual); },
};
export var LabelParams = __assign(__assign({}, LabelTextParams), { visuals: PD.MultiSelect(['label-text'], PD.objectToOptions(LabelVisuals)) });
export function getLabelParams(ctx, structure) {
return PD.clone(LabelParams);
}
export function LabelRepresentation(ctx, getParams) {
var repr = Representation.createMulti('Label', ctx, getParams, StructureRepresentationStateBuilder, LabelVisuals);
repr.setState({ pickable: false, markerActions: MarkerAction.None });
return repr;
}
export var LabelRepresentationProvider = StructureRepresentationProvider({
name: 'label',
label: 'Label',
description: 'Displays labels.',
factory: LabelRepresentation,
getParams: getLabelParams,
defaultValues: PD.getDefaultValues(LabelParams),
defaultColorTheme: { name: 'uniform' },
defaultSizeTheme: { name: 'physical' },
isApplicable: function (structure) { return structure.elementCount > 0; }
});