Coder Social home page Coder Social logo

Comments (6)

Norserium avatar Norserium commented on May 21, 2024 3

@junaid1840, well, the problem is that the cropper doesn't work correctly when you apply to the parent container the scale transformation.

That's because the cropper uses getBoundingClientRect under the hood to get the boundary size instead of clientWidth and clientHeight. That was needed to get the better subpixel precision required by the preview component.

Unfortunately, Chakra UI doesn't provide onOpened prop, that will be called, when the transition is completed. That would give you the possibility to display the cropper when the modal is finally opened or the possibility to call refresh() method to update the cropper like it's updating on window resize.

What can I offer you in this situtation?

  1. Change the transition animation from "scale" to something else.
  2. Try to process onTransitionEnd callback by himself and detect when the modal is finally opened, but be careful, there will be a lot of that events. It should solve your issue.
  3. This cropper is incredible flex and you can redefine the boundary size calculation that causes this issue initially. The example for the latest (it's important) version.

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@junaid1840, that's the serious bug.

  1. The current hypothesis, that the modal window size is changed after the cropper was initialized. Try to resize the window after the modal was opened.
  2. Try to place the cropper outside the modal window and the reproduce bug. If it's reproducing, send me the used image.

from react-advanced-cropper.

junaid1840 avatar junaid1840 commented on May 21, 2024

@Norserium You are absolutely correct. Thanks

  1. Resizing the window does fix the issue.
  2. Yes it is working fine outside the modal.

Any solution for dynamic width setting or maybe lazy loading the cropper ?

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@junaid1840, what's library do you use for the modal window? Why does it change the size when it's openning?

from react-advanced-cropper.

junaid1840 avatar junaid1840 commented on May 21, 2024

@Norserium I'm using Chakra UI and tailwind for styling.
https://chakra-ui.com/
https://tailwindcss.com/

from react-advanced-cropper.

Norserium avatar Norserium commented on May 21, 2024

@junaid1840, I close issue. Feel free to reopen it if the advice above didn't help you.

from react-advanced-cropper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.