advanced-cropper / react-advanced-cropper

The react cropper library that embraces power of the advanced cropper core to give the possibility to create croppers that exactly suited for your website design
https://advanced-cropper.github.io/react-advanced-cropper/
Other
619 stars 26 forks source link

Few questions #67

Open sadikyalcin opened 1 month ago

sadikyalcin commented 1 month ago

Very nice cropper. As documentation is incomplete, I haven't found answers to the following;

<Cropper
  ref={cropperRef}
  src={image}
  backgroundWrapperProps={{
    scaleImage: false,
  }}
  imageRestriction="fitArea"
  onChange={onChange}
  onMoveEnd={onMoveEnd}
  onResizeEnd={onResizeEnd}
  className="cropper"
  resizeImage={false}
  moveImage={false}
  checkOrientation={false}
  minWidth={props?.minWidth}
  minHeight={props?.minHeight}
  onReady={(cropper) => {
    // undefined: cropper, cropperRef.current
  }}
  // need a disabled prop so I can't only show a "preview" like UI until a button is clicked
  stencilProps={{
    handlers: isCropping ? true : false,
    lines: isCropping ? true : false,
    aspectRatio: props?.aspectRatio ? props?.aspectRatio : '',
    movable: isCropping ? true : false,
  }}
/>

Edit: found the issue with the responsiveness on my end. It is working as it should now. However, is there a way of defining a max width & height on the wrapper?

Norserium commented 1 month ago

@sadikyalcin, I've updated the cropper recently, to there are some answers.

Is there a way to disable the cropper? disabled: bool

I've added the disabled prop to <Cropper/> in 0.20.0.

Is there an img on load event?

You are right, it's onReady callback. It was fixed in 0.20.0 too.

However, is there a way of defining a max width & height on the wrapper?

It's need to reproduce your issue. Could you help me with that?