MCPcopy Index your code
hub / github.com/codeaashu/claude-code / intersectClip

Function intersectClip

src/ink/output.ts:104–112  ·  view source on GitHub ↗

* Intersect two clips. `undefined` on an axis means unbounded; the other * clip's bound wins. If both are bounded, take the tighter constraint * (max of mins, min of maxes). If the resulting region is empty * (x1 >= x2 or y1 >= y2), writes clipped by it will be dropped.

(parent: Clip | undefined, child: Clip)

Source from the content-addressed store, hash-verified

102 * (x1 >= x2 or y1 >= y2), writes clipped by it will be dropped.
103 */
104function intersectClip(parent: Clip | undefined, child: Clip): Clip {
105 if (!parent) return child
106 return {
107 x1: maxDefined(parent.x1, child.x1),
108 x2: minDefined(parent.x2, child.x2),
109 y1: maxDefined(parent.y1, child.y1),
110 y2: minDefined(parent.y2, child.y2),
111 }
112}
113
114function maxDefined(
115 a: number | undefined,

Callers 1

getMethod · 0.85

Calls 2

maxDefinedFunction · 0.85
minDefinedFunction · 0.85

Tested by

no test coverage detected