diff --git a/src/mol-data/int/_spec/ordered-set.spec.ts b/src/mol-data/int/_spec/ordered-set.spec.ts index a8f2a5d10c39c9f771c0d6da0eca81c299a39537..e39cb3c0933aae2aae90a6a2a29907e86e043c26 100644 --- a/src/mol-data/int/_spec/ordered-set.spec.ts +++ b/src/mol-data/int/_spec/ordered-set.spec.ts @@ -56,6 +56,9 @@ describe('ordered set', () => { expect(OrderedSet.areIntersecting(Interval.ofRange(4, 5), arr12369)).toBe(false); expect(OrderedSet.areIntersecting(Interval.ofRange(7, 8), arr12369)).toBe(false); + + expect(OrderedSet.areIntersecting(Interval.ofRange(6, 6), arr12369)).toBe(true); + expect(OrderedSet.areIntersecting(Interval.ofRange(3, 4), OrderedSet.ofSortedArray([0, 1, 10]))).toBe(false); }); it('isSubset', () => { diff --git a/src/mol-data/int/impl/ordered-set.ts b/src/mol-data/int/impl/ordered-set.ts index 6031729daf7a67e650a617ca86a20a562081b139..e6b3bec702a30c90388908490a4935ca826e4038 100644 --- a/src/mol-data/int/impl/ordered-set.ts +++ b/src/mol-data/int/impl/ordered-set.ts @@ -99,10 +99,7 @@ export function subtract(a: OrderedSetImpl, b: OrderedSetImpl) { function areEqualIS(a: I, b: S) { return I.size(a) === S.size(b) && I.start(a) === S.start(b) && I.end(a) === S.end(b); } function areIntersectingSI(a: S, b: I) { - if (S.size(a) === 0 || I.size(b) === 0) return false - const predAMinB = S.findPredecessorIndex(a, I.min(b)) - const predAMaxB = S.findPredecessorIndex(a, I.max(b)) - return predAMinB !== predAMaxB + return a.length !== 0 && I.size(S.findRange(a, I.min(b), I.max(b))) !== 0; } function isSubsetSI(a: S, b: I) {