diff --git a/src/mol-plugin/behavior/dynamic/custom-props.ts b/src/mol-plugin/behavior/dynamic/custom-props.ts index d82ae6dacb61b9fa6f4a6a22d30c3ab440808219..3b4c6f941c05684c6ff4b83aa7df9b2d6285a8d3 100644 --- a/src/mol-plugin/behavior/dynamic/custom-props.ts +++ b/src/mol-plugin/behavior/dynamic/custom-props.ts @@ -36,7 +36,6 @@ export const PDBeStructureQualityReport = PluginBehavior.create<{ autoAttach: bo // TODO: support filtering of themes based on the input structure // in this case, it would check structure.models[0].customProperties.has(StructureQualityReport.Descriptor) - // TODO: add remove functionality this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.add('pdbe-structure-quality-report', { label: 'PDBe Structure Quality Report', factory: StructureQualityReportColorTheme, @@ -54,9 +53,7 @@ export const PDBeStructureQualityReport = PluginBehavior.create<{ autoAttach: bo unregister() { this.ctx.customModelProperties.unregister(StructureQualityReport.Descriptor.name); this.ctx.lociLabels.removeProvider(labelPDBeValidation); - - // TODO: add remove functionality to registry - // this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.remove('pdbe-structure-quality-report') + this.ctx.structureRepresentation.themeCtx.colorThemeRegistry.remove('pdbe-structure-quality-report') } }, params: () => ({ diff --git a/src/mol-repr/representation.ts b/src/mol-repr/representation.ts index 8a33749569e89fec698941b186b908411f341edb..0644bd17a1f899b5e8c1280887b83d55a2cf64c2 100644 --- a/src/mol-repr/representation.ts +++ b/src/mol-repr/representation.ts @@ -70,6 +70,11 @@ export class RepresentationRegistry<D> { this._map.set(name, provider) } + remove(name: string) { + this._list.splice(this._list.findIndex(e => e.name === name)) + this._map.delete(name) + } + get<P extends PD.Params>(name: string): RepresentationProvider<D, P> { return this._map.get(name) || EmptyRepresentationProvider as unknown as RepresentationProvider<D, P> } diff --git a/src/mol-theme/color.ts b/src/mol-theme/color.ts index 2368ecae72671b1d35a9a7cd9b0bda7da8f61154..e01bf5a667876dce361bbc51a312fe6771fb2cd5 100644 --- a/src/mol-theme/color.ts +++ b/src/mol-theme/color.ts @@ -79,6 +79,11 @@ namespace ColorTheme { this._map.set(name, provider) } + remove(name: string) { + this._list.splice(this._list.findIndex(e => e.name === name)) + this._map.delete(name) + } + get<P extends PD.Params>(name: string): Provider<P> { return this._map.get(name) || EmptyProvider as unknown as Provider<P> } diff --git a/src/mol-theme/size.ts b/src/mol-theme/size.ts index 66da14adaa82c7640b8f42b852c576b737e213b6..fe5a3a35265b6f11d71343e3c93508fdd75257e5 100644 --- a/src/mol-theme/size.ts +++ b/src/mol-theme/size.ts @@ -57,6 +57,11 @@ namespace SizeTheme { this._map.set(name, provider) } + remove(name: string) { + this._list.splice(this._list.findIndex(e => e.name === name)) + this._map.delete(name) + } + get<P extends PD.Params>(id: string) { return this._map.get(id) || EmptyProvider as unknown as Provider<P> }