MCPcopy Index your code
hub / github.com/cifertech/DisplayKit / considerVertical

Function considerVertical

app.js:552–569  ·  view source on GitHub ↗
(other)

Source from the content-addressed store, hash-verified

550 }
551
552 function considerVertical(other) {
553 const ox = other.x;
554 const oy = other.y;
555 const ow = other.w;
556 const oh = other.h;
557 const xOverlap = !(x + w <= ox || x >= ox + ow);
558 if (!xOverlap) return;
559 if (oy >= y + h) {
560 const g = oy - (y + h);
561 if (g >= 0 && g <= cap && (!bestV || g < bestV.g))
562 bestV = { g, mx: (Math.max(x, ox) + Math.min(x + w, ox + ow)) / 2, my: (y + h + oy) / 2 };
563 }
564 if (oy + oh <= y) {
565 const g = y - (oy + oh);
566 if (g >= 0 && g <= cap && (!bestV || g < bestV.g))
567 bestV = { g, mx: (Math.max(x, ox) + Math.min(x + w, ox + ow)) / 2, my: (oy + oh + y) / 2 };
568 }
569 }
570
571 for (const o of elements) {
572 if (o.id === excludeId || o.hidden) continue;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected