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