Skip to content

Commit

Permalink
Fix zero height start or end items being prevented from inflating (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvitalha authored and muskeinsingh committed Aug 21, 2019
1 parent d670dc4 commit f55b989
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/ViewabilityTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,15 @@ export default class ViewabilityTracker {
return (window.start >= startBound && window.end <= endBound);
}

private _isZeroHeightEdgeElement(window: Range, startBound: number, endBound: number): boolean {
return startBound - endBound === 0 && (window.start === startBound || window.end === endBound);
}

private _itemIntersectsWindow(window: Range, startBound: number, endBound: number): boolean {
return this._isItemInBounds(window, startBound) ||
this._isItemInBounds(window, endBound) ||
this._isItemBoundsBeyondWindow(window, startBound, endBound);
this._isItemBoundsBeyondWindow(window, startBound, endBound) ||
this._isZeroHeightEdgeElement(window, startBound, endBound);
}

private _itemIntersectsEngagedWindow(startBound: number, endBound: number): boolean {
Expand Down

0 comments on commit f55b989

Please sign in to comment.