소스 검색

added StructureElement.set

Alexander Rose 5 년 전
부모
커밋
8a4ef015a2
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  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>