📌  相关文章
📜  用于检查两个形状是否重叠的 js 库 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:03.303000             🧑  作者: Mango

代码示例1
function rectangle(x, y, w, h) {

    ... existing code here ...

}

rectangle.prototype.intersects = function(rect) {
    return !( rect.x           > (this.x + this.w) || 
             (rect.x + rect.w) <  this.x           || 
              rect.y           > (this.y + this.h) ||
             (rect.y + rect.h) <  this.y);
}