Parcourir la source

add InterUnitBonds.hasBond

Alexander Rose il y a 5 ans
Parent
commit
56fd6d6a5b
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      src/mol-model/structure/structure/unit/links/data.ts

+ 5 - 0
src/mol-model/structure/structure/unit/links/data.ts

@@ -38,6 +38,11 @@ class InterUnitBonds {
         return index !== undefined ? index : -1
     }
 
+    /** Check if bond exists */
+    hasBond(indexA: StructureElement.UnitIndex, unitA: Unit, indexB: StructureElement.UnitIndex, unitB: Unit): boolean {
+        return this.getBondIndex(indexA, unitA, indexB, unitB) !== -1
+    }
+
     /** Get inter-unit bond given a pair of indices and units */
     getBond(indexA: StructureElement.UnitIndex, unitA: Unit, indexB: StructureElement.UnitIndex, unitB: Unit): InterUnitBonds.Bond | undefined {
         const index = this.getBondIndex(indexA, unitA, indexB, unitB)