private getElementsInDirection()

in src/focus-strategies/focus-by-distance.ts [151:166]


  private getElementsInDirection() {
    return this.shortlisted.filter(el => {
      switch (this.dir) {
        case Direction.LEFT:
          return el.rect.right <= this.refRect.left;
        case Direction.RIGHT:
          return el.rect.left >= this.refRect.right;
        case Direction.UP:
          return el.rect.bottom <= this.refRect.top;
        case Direction.DOWN:
          return el.rect.top >= this.refRect.bottom;
        default:
          throw new Error(`Invalid direction ${this.dir}`);
      }
    });
  }