code: function clamp(rect, clampRect, fixedSize) {
        var underflowX1, underflowY1, overflowX2, overflowY2,
          x1, y1, x2, y2, cx2, cy2;
  
        x1 = rect.x;
        y1 = rect.y;
        x2 = rect.x + rect.w;
        y2 = rect.y + rect.h;
        cx2 = clampRect.x + clampRect.w;
        cy2 = clampRect.y + clampRect.h;
  
        underflowX1 = max(0, clampRect.x - x1);
        underflowY1 = max(0, clampRect.y - y1);
        overflowX2 = max(0, x2 - cx2);
        overflowY2 = max(0, y2 - cy2);
  
        x1 += underflowX1;
        y1 += underflowY1;
  
        if (fixedSize) {
          x2 += underflowX1;
          y2 += underflowY1;
          x1 -= overflowX2;
          y1 -= overflowY2;
        }
  
        x2 -= overflowX2;
        y2 -= overflowY2;
  
        return create(x1, y1, x2 - x1, y2 - y1);
      }
docs: Returns a rect clamped within the specified clamp rect. This forces the
  rect to be inside the clamp rect.
  
  @method clamp
  @param {Rect} rect Rectangle to force within clamp rect.
  @param {Rect} clampRect Rectable to force within.
  @param {Boolean} fixedSize True/false if size should be fixed.
  @return {Rect} Clamped rect.