Answers for "check if two rectangles overlap javascript canvas"

1

check if two rectangles overlap javascript canvas

// Where left, right, top and bottom are essentially edges

if (a.left >= b.right || a.top >= b.bottom || 
    a.right <= b.left || a.bottom <= b.top)
{
    // no overlap
}
else
{
    // overlap
}
Posted by: Guest on July-24-2020

Code answers related to "check if two rectangles overlap javascript canvas"

Code answers related to "Javascript"

Browse Popular Code Answers by Language