(tweets: NodeList)
| 407 | } |
| 408 | |
| 409 | private getFirstTweetInView(tweets: NodeList): HTMLElement | null { |
| 410 | const viewTop = document.body.scrollTop; |
| 411 | const viewBottom = viewTop + window.innerHeight; |
| 412 | for (const tw of tweets) { |
| 413 | const rect = (tw as HTMLDivElement).getBoundingClientRect(); |
| 414 | const top = viewTop + rect.top; |
| 415 | const bottom = viewTop + rect.bottom; |
| 416 | const inView = (viewTop <= top && top < viewBottom) || |
| 417 | (viewTop < bottom && bottom <= viewBottom); |
| 418 | if (inView) { |
| 419 | return tw as HTMLDivElement; |
| 420 | } |
| 421 | } |
| 422 | return null; |
| 423 | } |
| 424 | |
| 425 | private setCurrentFocusedTweet(tw: HTMLElement | null) { |
| 426 | if (this.focusedTweet !== null) { |
no outgoing calls
no test coverage detected