in src/focus/focus-by-distance.ts [176:191]
private getElementsInDirection() {
return this.shortlisted.filter(el => {
switch (this.dir) {
case Button.Left:
return el.rect.right <= this.refRect.left;
case Button.Right:
return el.rect.left >= this.refRect.right;
case Button.Up:
return el.rect.bottom <= this.refRect.top;
case Button.Down:
return el.rect.top >= this.refRect.bottom;
default:
throw new Error(`Invalid direction ${this.dir}`);
}
});
}