demos/Collage/fabric.js
function(selectionTL, selectionBR) {
      var oCoords = this.oCoords,
          tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
          tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
          bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
          br = new fabric.Point(oCoords.br.x, oCoords.br.y);

      var intersection = fabric.Intersection.intersectPolygonRectangle(
        [tl, tr, br, bl],
        selectionTL,
        selectionBR
      );
      return (intersection.status === 'Intersection');
    }
function(selectionTL, selectionBR) {
      var oCoords = this.oCoords,
          tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),
          tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),
          bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),
          br = new fabric.Point(oCoords.br.x, oCoords.br.y);

      var intersection = fabric.Intersection.intersectPolygonRectangle(
        [tl, tr, br, bl],
        selectionTL,
        selectionBR
      );
      return (intersection.status === 'Intersection');
    }
function ( selectionTL , selectionBR ) { var oCoords = this . oCoords , tl = new fabric . Point ( oCoords . tl . x , oCoords . tl . y ) , tr = new fabric . Point ( oCoords . tr . x , oCoords . tr . y ) , bl = new fabric . Point ( oCoords . bl . x , oCoords . bl . y ) , br = new fabric . Point ( oCoords . br . x , oCoords . br . y ) ; var intersection = fabric . Intersection . intersectPolygonRectangle ( [ tl , tr , br , bl ] , selectionTL , selectionBR ) ; return ( intersection . status === 'Intersection' ) ; }
Returns true if object intersects with an area formed by 2 points
@method intersectsWithRect
@param {Object} selectionTL
@param {Object} selectionBR
@return {Boolean}
Returns true if object intersects with an area formed by 2 points