I was looking for the javascript equivalent of the CoreGraphics function of CGRectUnion. I found isPointInPath. I was reading about clip paths so thought this was very much a possibility.
What this function does is take two rectangles.
function CGRectUnion(rect1, rect2) {
}
Each rect object has 4 keys, w, h, x, and y. x and y is the top left coordinate of the rectangle and w and h are the width and height.
The function returns false if no portion of rect2 overlaps rect1. If rect2 overlaps rect1 it then returns a rectangle object of the common area between the two rectangles.
Is there a built in function like this in javascript, especially canvas related area?
Thanks