distance
ts
function Rect.distance(a: Rect, b: Rect): numberCalculates the shortest distance between two rectangles. Returns 0 if the rectangles intersect.
Example
ts
Rect.distance(
{ left: 0, top: 0, width: 50, height: 50 },
{ left: 100, top: 0, width: 50, height: 50 },
);
// 50ts
pipe(
{ left: 0, top: 0, width: 50, height: 50 },
Rect.distance({ left: 100, top: 0, width: 50, height: 50 }),
);
// 50