MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / considerHorizontal

Function considerHorizontal

app.js:533–550  ·  view source on GitHub ↗
(other)

Source from the content-addressed store, hash-verified

531 let bestV = null;
532
533 function considerHorizontal(other) {
534 const ox = other.x;
535 const oy = other.y;
536 const ow = other.w;
537 const oh = other.h;
538 const yOverlap = !(y + h <= oy || y >= oy + oh);
539 if (!yOverlap) return;
540 if (ox >= x + w) {
541 const g = ox - (x + w);
542 if (g >= 0 && g <= cap && (!bestH || g < bestH.g))
543 bestH = { g, mx: (x + w + ox) / 2, my: (Math.max(y, oy) + Math.min(y + h, oy + oh)) / 2 };
544 }
545 if (ox + ow <= x) {
546 const g = x - (ox + ow);
547 if (g >= 0 && g <= cap && (!bestH || g < bestH.g))
548 bestH = { g, mx: (ox + ow + x) / 2, my: (Math.max(y, oy) + Math.min(y + h, oy + oh)) / 2 };
549 }
550 }
551
552 function considerVertical(other) {
553 const ox = other.x;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected