dist/cropper.common.js
function setCropBoxData(data) {
    var cropBoxData = this.cropBoxData;
    var aspectRatio = this.options.aspectRatio;

    var widthChanged = void 0;
    var heightChanged = void 0;

    if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
      if (isNumber(data.left)) {
        cropBoxData.left = data.left;
      }

      if (isNumber(data.top)) {
        cropBoxData.top = data.top;
      }

      if (isNumber(data.width) && data.width !== cropBoxData.width) {
        widthChanged = true;
        cropBoxData.width = data.width;
      }

      if (isNumber(data.height) && data.height !== cropBoxData.height) {
        heightChanged = true;
        cropBoxData.height = data.height;
      }

      if (aspectRatio) {
        if (widthChanged) {
          cropBoxData.height = cropBoxData.width / aspectRatio;
        } else if (heightChanged) {
          cropBoxData.width = cropBoxData.height * aspectRatio;
        }
      }

      this.renderCropBox();
    }

    return this;
  }
function setCropBoxData(data) {
    var cropBoxData = this.cropBoxData;
    var aspectRatio = this.options.aspectRatio;

    var widthChanged = void 0;
    var heightChanged = void 0;

    if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
      if (isNumber(data.left)) {
        cropBoxData.left = data.left;
      }

      if (isNumber(data.top)) {
        cropBoxData.top = data.top;
      }

      if (isNumber(data.width) && data.width !== cropBoxData.width) {
        widthChanged = true;
        cropBoxData.width = data.width;
      }

      if (isNumber(data.height) && data.height !== cropBoxData.height) {
        heightChanged = true;
        cropBoxData.height = data.height;
      }

      if (aspectRatio) {
        if (widthChanged) {
          cropBoxData.height = cropBoxData.width / aspectRatio;
        } else if (heightChanged) {
          cropBoxData.width = cropBoxData.height * aspectRatio;
        }
      }

      this.renderCropBox();
    }

    return this;
  }
function setCropBoxData ( data ) { var cropBoxData = this . cropBoxData ; var aspectRatio = this . options . aspectRatio ; var widthChanged = void 0 ; var heightChanged = void 0 ; if ( this . ready && this . cropped && ! this . disabled && isPlainObject ( data ) ) { if ( isNumber ( data . left ) ) { cropBoxData . left = data . left ; } if ( isNumber ( data . top ) ) { cropBoxData . top = data . top ; } if ( isNumber ( data . width ) && data . width !== cropBoxData . width ) { widthChanged = true ; cropBoxData . width = data . width ; } if ( isNumber ( data . height ) && data . height !== cropBoxData . height ) { heightChanged = true ; cropBoxData . height = data . height ; } if ( aspectRatio ) { if ( widthChanged ) { cropBoxData . height = cropBoxData . width / aspectRatio ; } else if ( heightChanged ) { cropBoxData . width = cropBoxData . height * aspectRatio ; } } this . renderCropBox ( ) ; } return this ; }
Set the crop box position and size with new data.
@param {Object} data - The new crop box data.
@returns {Cropper} this
Set the crop box position and size with new data .