Comments (6)
@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?
- Change the transition animation from
"scale"
to something else. - 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. - 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.
@junaid1840, that's the serious bug.
- 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.
- 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.
@Norserium You are absolutely correct. Thanks
- Resizing the window does fix the issue.
- Yes it is working fine outside the modal.
Any solution for dynamic width setting or maybe lazy loading the cropper ?
from react-advanced-cropper.
@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.
@Norserium I'm using Chakra UI and tailwind for styling.
https://chakra-ui.com/
https://tailwindcss.com/
from react-advanced-cropper.
@junaid1840, I close issue. Feel free to reopen it if the advice above didn't help you.
from react-advanced-cropper.
Related Issues (20)
- Typescript type issue HOT 4
- Zoom in and out doesn't work properly HOT 5
- How can i add filters? like black & white. I see you have given Hue, Staturation sliders. But what about proper filters? HOT 9
- how to rotate image using a slider? from -360 to 360 HOT 5
- How to handle images that are bigger than the screen HOT 4
- resize work reverse in rtl app HOT 4
- Set default cropping area? HOT 5
- editor.setState() is working? HOT 6
- `parentSelector` to have Cropper working inside iframe HOT 2
- Metadata Getting erased HOT 2
- Replacing CustomBackgroundWrapper with a custom component results in component not working HOT 2
- Works with Remix? HOT 2
- Applying a transform to the preview only HOT 10
- Preview to Canvas? HOT 4
- How to make stencil to minWidth and minHeight.
- Blinking issue with the image on page loads. HOT 2
- Unable to Change Wrapper Color to White HOT 5
- URGENT - Image wrongly sized on Safari HOT 7
- Mouse resizing doesn't work HOT 5
- change the stencilComponent to use an oval instead of a circle or rectangle? HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-advanced-cropper.