in src/shapes/shapes.ts [214:227]
export function combine(rect1: IRect, rect2: IRect): IRect {
if (!rect1) {
return rect2;
}
if (!rect2) {
return rect1;
}
let left = Math.min(rect1.left, rect2.left);
let top = Math.min(rect1.top, rect2.top);
let right = Math.max(rect1.left + rect1.width, rect2.left + rect2.width);
let bottom = Math.max(rect1.top + rect1.height, rect2.top + rect2.height);
return { left: left, top: top, width: right - left, height: bottom - top };
}