pdbe-molstar
Version:
Molstar implementation for PDBe
46 lines (45 loc) • 2.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PDBeDomainAnnotations = void 0;
const behavior_1 = require("molstar/lib/mol-plugin/behavior");
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
const color_1 = require("./color");
const prop_1 = require("./prop");
exports.PDBeDomainAnnotations = behavior_1.PluginBehavior.create({
name: 'pdbe-domain-annotations-prop',
category: 'custom-props',
display: {
name: 'Domain annotations',
description: 'Data for domain annotations, obtained via PDBe.',
},
ctor: class extends behavior_1.PluginBehavior.Handler {
constructor() {
super(...arguments);
this.provider = prop_1.DomainAnnotationsProvider;
this.labelDomainAnnotations = {
label: (loci) => undefined,
};
}
register() {
this.ctx.customModelProperties.register(this.provider, this.params.autoAttach);
this.ctx.managers.lociLabels.addProvider(this.labelDomainAnnotations);
this.ctx.representation.structure.themes.colorThemeRegistry.add(color_1.DomainAnnotationsColorThemeProvider);
}
update(p) {
const updated = this.params.autoAttach !== p.autoAttach;
this.params.autoAttach = p.autoAttach;
this.params.showTooltip = p.showTooltip;
this.ctx.customModelProperties.setDefaultAutoAttach(this.provider.descriptor.name, this.params.autoAttach);
return updated;
}
unregister() {
this.ctx.customModelProperties.unregister(prop_1.DomainAnnotationsProvider.descriptor.name);
this.ctx.managers.lociLabels.removeProvider(this.labelDomainAnnotations);
this.ctx.representation.structure.themes.colorThemeRegistry.remove(color_1.DomainAnnotationsColorThemeProvider);
}
},
params: () => ({
autoAttach: param_definition_1.ParamDefinition.Boolean(false),
showTooltip: param_definition_1.ParamDefinition.Boolean(true),
}),
});