Browse Source

added StructureElement.set

Alexander Rose 5 years ago
parent
commit
8a4ef015a2
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/mol-model/structure/structure/element.ts

+ 6 - 0
src/mol-model/structure/structure/element.ts

@@ -31,6 +31,12 @@ namespace StructureElement {
         return { kind: 'element-location', unit: unit!, element: element || (0 as ElementIndex) };
     }
 
+    export function set(a: StructureElement, unit?: Unit, element?: ElementIndex): StructureElement {
+        if (unit) a.unit = unit
+        if (element !== undefined) a.element = element
+        return a;
+    }
+
     // TODO: when nominal types are available, make this indexed by UnitIndex
     export type Set = SortedArray<ElementIndex>