MCPcopy Create free account
hub / github.com/Noumena-Network/code / blitEscapingAbsoluteDescendants

Function blitEscapingAbsoluteDescendants

src/ink/render-node-to-output.ts:1355–1387  ·  view source on GitHub ↗
(
  node: DOMElement,
  output: Output,
  prevScreen: Screen,
  px: number,
  py: number,
  pw: number,
  ph: number,
)

Source from the content-addressed store, hash-verified

1353// to float above the prompt; a spinner tick in the ScrollBox above re-renders
1354// and overwrites those cells. Without this, the menu vanishes on the next frame.
1355function blitEscapingAbsoluteDescendants(
1356 node: DOMElement,
1357 output: Output,
1358 prevScreen: Screen,
1359 px: number,
1360 py: number,
1361 pw: number,
1362 ph: number,
1363): void {
1364 const pr = px + pw
1365 const pb = py + ph
1366 for (const child of node.childNodes) {
1367 if (child.nodeName === '#text') continue
1368 const elem = child as DOMElement
1369 if (elem.style.position === 'absolute') {
1370 const cached = nodeCache.get(elem)
1371 if (cached) {
1372 absoluteRectsCur.push(cached)
1373 const cx = Math.floor(cached.x)
1374 const cy = Math.floor(cached.y)
1375 const cw = Math.floor(cached.width)
1376 const ch = Math.floor(cached.height)
1377 // Only blit rects that extend outside the parent's layout bounds —
1378 // cells within the parent rect are already covered by the parent blit.
1379 if (cx < px || cy < py || cx + cw > pr || cy + ch > pb) {
1380 output.blit(prevScreen, cx, cy, cw, ch)
1381 }
1382 }
1383 }
1384 // Recurse — absolute descendants can be nested arbitrarily deep
1385 blitEscapingAbsoluteDescendants(elem, output, prevScreen, px, py, pw, ph)
1386 }
1387}
1388
1389// Render children of a scroll container with viewport culling.
1390// scrollTopY..scrollBottomY are the visible window in CHILD-LOCAL Yoga coords

Callers 1

renderNodeToOutputFunction · 0.85

Calls 2

blitMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected