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);

      return tl.x > selectionTL.x
        && tr.x < selectionBR.x
        && tl.y > selectionTL.y
        && bl.y < selectionBR.y;
    }
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);

      return tl.x > selectionTL.x
        && tr.x < selectionBR.x
        && tl.y > selectionTL.y
        && bl.y < selectionBR.y;
    }
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 ) ; return tl . x > selectionTL . x && tr . x < selectionBR . x && tl . y > selectionTL . y && bl . y < selectionBR . y ; }
Returns true if object is fully contained within area formed by 2 points
@method isContainedWithinRect
@param {Object} selectionTL
@param {Object} selectionBR
@return {Boolean}
Returns true if object is fully contained within area formed by 2 points