Browse Source

add repr/theme registry .clear method

Alexander Rose 2 years ago
parent
commit
55f4abb6be
3 changed files with 15 additions and 3 deletions
  1. 7 1
      src/mol-repr/representation.ts
  2. 1 1
      src/mol-repr/structure/registry.ts
  3. 7 1
      src/mol-theme/theme.ts

+ 7 - 1
src/mol-repr/representation.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -135,6 +135,12 @@ export class RepresentationRegistry<D, S extends Representation.State> {
     getApplicableTypes(data: D) {
         return getTypes(this.getApplicableList(data));
     }
+
+    clear() {
+        this._list.length = 0;
+        this._map.clear();
+        this._name.clear();
+    }
 }
 
 //

+ 1 - 1
src/mol-repr/structure/registry.ts

@@ -41,7 +41,7 @@ export namespace StructureRepresentationRegistry {
         'carbohydrate': CarbohydrateRepresentationProvider,
         'ellipsoid': EllipsoidRepresentationProvider,
         'gaussian-surface': GaussianSurfaceRepresentationProvider,
-        'gaussian-volume': GaussianVolumeRepresentationProvider, // TODO disabled for now, needs more work
+        'gaussian-volume': GaussianVolumeRepresentationProvider,
         'label': LabelRepresentationProvider,
         'line': LineRepresentationProvider,
         'molecular-surface': MolecularSurfaceRepresentationProvider,

+ 7 - 1
src/mol-theme/theme.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -156,4 +156,10 @@ export class ThemeRegistry<T extends ColorTheme<any, any> | SizeTheme<any>> {
     getApplicableTypes(ctx: ThemeDataContext) {
         return getTypes(this.getApplicableList(ctx));
     }
+
+    clear() {
+        this._list.length = 0;
+        this._map.clear();
+        this._name.clear();
+    }
 }