-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Applying a transform to the preview only #44
Comments
Here's an example of what I mean, the pink rectangle is the preview container, it is the correct size. The inner image is the preview itself from the cropper. Here's the version without a rotation transform of zero degrees applied to the preview container, you can see no pink background this time because the preview image is perfectly sized: Bizarrely, at least to me, this rectangle rotation transform seems to work OK until it reaches 64 degrees, at which point the pink background is visible round the edges, and then as you increase rotation past 64 degrees the image gets smaller and smaller until you see the first screenshot at 90 degrees. |
@caprica, could you create the sandbox that reproduces this issue? Also, it would be helpful if you record a video. |
OK, so the problem comes down to this, What I am trying to achieve is to set an explicit pixel size on the preview. I need this so it fits into a specific part of my overall layout. Here is a sandbox: https://codesandbox.io/s/ancient-platform-5ptth9 This sandbox shows a cropper with two previews. The first with a rotation that is not sized correctly. It keeps the same width, after rotation. The second preview is normal, without any transformation, and is sized perfectly. So I am not sure if I am just using CSS transforms incorrectly, or if there is some weird interaction between my rotated preview size and your library. But either way, I'm a bit stuck, so any tips would be very welcome. (Also, anytime I make a change to the sandbox, I need to do a full refresh of the browser view otherwise the layout goes weird). |
@caprica, that is the peculiarity of First of all, why do you need to rotate the preview? Secondly, I added in the last version the possibility to redefine the size algorithm to use, for example, |
I need to rotate the preview because of a requirement I have to place the cropped image into a particular place in our UI design. The rotation won't be as severe as 90 degrees, that was just to illustrate the worst-case of the problem. Thanks a lot for the example. |
@caprica, don't forget to update to the latest version |
Again, thanks. This is a really nicely implemented library and I hope I can get it working how I need. |
@Norserium do you have Ko-Fi or GitHub sponsor account or something? I installed the new version with your size algorithm change and I think it's working beautifully. I only say "think" because I can't quite believe it. |
@caprica, I don't have any of that accounts, but thank you for your proposal. I appreciate that. Good luck with the project! |
I would like to apply a rotation transform to only the preview, not the image in the cropper itself.
When I try this, I think I am seeing some weird interaction between the cropper and the wrapper div containing the preview that I rotate that is confusing the calculated size applied to the preview.
For example, if I apply
transform: rotate(90deg)
to the preview wrapper component, it rotates correctly, but it halves the height of the preview content.Obviously a normal div wouldn't lose half the height when rotated.
Anyone has any clues or examples on how I might get this working for preview?
The text was updated successfully, but these errors were encountered: