MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / pickNodeBox

Function pickNodeBox

graph-ui/tools/smoke-w11b.mjs:555–575  ·  view source on GitHub ↗
(page, options)

Source from the content-addressed store, hash-verified

553 * Messung an derselben Stelle.
554 */
555const pickNodeBox = (page, options) =>
556 page.evaluate((input) => {
557 const frame = (globalThis.__w11b ?? {})[input.name];
558 if (frame === undefined) {
559 return null;
560 }
561 const far = (x, y) => input.bodies.every((body) =>
562 Math.hypot(x - body.x, y - body.y) > input.distance);
563 let best = null;
564 for (let y = input.half; y < frame.height - input.half; y += 4) {
565 for (let x = input.half; x < frame.width - input.half; x += 4) {
566 const i = (y * frame.width + x) * 4;
567 const luminance = 0.2126 * frame.data[i]
568 + 0.7152 * frame.data[i + 1] + 0.0722 * frame.data[i + 2];
569 if ((best === null || luminance > best.luminance) && far(x, y)) {
570 best = { x, y, luminance: Number(luminance.toFixed(2)) };
571 }
572 }
573 }
574 return best;
575 }, options);
576
577/** Die mittlere Helligkeit eines Kastens in einem abgelegten Bild. */
578const boxLuminance = (page, options) =>

Callers 1

mainFunction · 0.85

Calls 1

farFunction · 0.85

Tested by

no test coverage detected