MCPcopy Create free account
hub / github.com/rhysd/Tui / getFirstTweetInView

Method getFirstTweetInView

webview/keymaps_handler.ts:409–423  ·  view source on GitHub ↗
(tweets: NodeList)

Source from the content-addressed store, hash-verified

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) {

Callers 3

'scroll-down-page'Method · 0.95
'scroll-up-page'Method · 0.95
moveFocusByOffsetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected