MCPcopy Create free account
hub / github.com/idank/explainshell / inview

Function inview

explainshell/web/static/js/es.js:1135–1142  ·  view source on GitHub ↗
(viewtop, viewbottom, el)

Source from the content-addressed store, hash-verified

1133}
1134
1135function inview(viewtop, viewbottom, el) {
1136 const rect = el.getBoundingClientRect();
1137 const elemmiddle = rect.top + window.scrollY + rect.height / 2;
1138
1139 // we consider the element to be in view when its middle is
1140 // within the viewport
1141 return viewtop < elemmiddle && viewbottom > elemmiddle;
1142}
1143
1144function drawvisible() {
1145 let viewtop = window.scrollY;

Callers 1

drawvisibleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected