Skip to content

Default cropsize is {width: 0, height: 0} #267

Closed
@nickisyourfan

Description

@nickisyourfan

Describe the bug
Hello! I think maybe I found a bug? I have been messing with this for a few hours and am stumped... The first time I used this inside a modal it worked great! This time, I am using it inside a modal with a collapse and am getting a default cropSize of {width: 0, height: 0} -- I have checked the docs a ton and read through the issues but can't seem to find one that matches what I am experiencing.

Either way - I am loving the package and hope that this is just me missing something crazy obvious - I have tried to set the default crop size manually - but that makes it so the image does not get centered by default.

I have attached a quick video to show my problem... and some code below.

Funny part is, if I resize the window, it recalculates the cropSize and it works.

  <CCollapse show={showCropper} className="my-2">
      <CContainer
        className="position-relative"
        style={{ height: "60vh", width: "75%", position: "relative" }}
      >
        <Cropper
          image={inputImg}
          crop={crop}
          zoom={zoom}
          aspect={aspect}
          onCropChange={onCropChange}
          onCropComplete={onCropComplete}
          onZoomChange={onZoomChange}
        />
      </CContainer>
      <CButton
        color="success"
        className="w-75"
        style={{ borderTopRightRadius: 0, borderTopLeftRadius: 0 }}
      >
        Save New Version
      </CButton>
    </CCollapse>

I have also forced this not to load unless the image is loaded, without luck.

Thanks for the help!

Quick Video of Problem:
https://user-images.githubusercontent.com/62756900/122150245-f59f4d80-ce22-11eb-935f-e12c75b1fc46.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions