Skip to content
Snippets Groups Projects
Commit c15a1bff authored by Alexander Rose's avatar Alexander Rose
Browse files

fix circular import issue

parent 13021f42
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,9 @@ import { Unit, StructureElement, StructureProperties as Props } from 'mol-model/ ...@@ -9,8 +9,9 @@ import { Unit, StructureElement, StructureProperties as Props } from 'mol-model/
import { Loci } from 'mol-model/loci'; import { Loci } from 'mol-model/loci';
import { OrderedSet } from 'mol-data/int'; import { OrderedSet } from 'mol-data/int';
const elementLocA = StructureElement.create() // for `labelFirst`, don't create right away to avaiod problems with circular dependencies/imports
const elementLocB = StructureElement.create() let elementLocA: StructureElement
let elementLocB: StructureElement
function setElementLocation(loc: StructureElement, unit: Unit, index: StructureElement.UnitIndex) { function setElementLocation(loc: StructureElement, unit: Unit, index: StructureElement.UnitIndex) {
loc.unit = unit loc.unit = unit
...@@ -18,6 +19,9 @@ function setElementLocation(loc: StructureElement, unit: Unit, index: StructureE ...@@ -18,6 +19,9 @@ function setElementLocation(loc: StructureElement, unit: Unit, index: StructureE
} }
export function labelFirst(loci: Loci): string { export function labelFirst(loci: Loci): string {
if (!elementLocA) elementLocA = StructureElement.create()
if (!elementLocB) elementLocB = StructureElement.create()
switch (loci.kind) { switch (loci.kind) {
case 'element-loci': case 'element-loci':
const e = loci.elements[0] const e = loci.elements[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment