Closed Daedren closed 2 years ago
@Daedren, hello! Are you sure, that you provided the correct link to the codesandbox? Currently, you provided the link to my own template.
Oh whoops, I messed up.
I've updated the original comment with the correct link.
@Daedren, in other words, do you want to get this result?
Yeah that would be my objective. Am I messing something up on my end?
@Daedren, well, there is the detail, that you actually missed.
First of all, the cropper tries to stretch the container as much as possible to fit the image completely by setting the fixed height and width to the stretcher:
As a result, the parent elements (.cropper
and then #cropperParent
) becomes the same size as the stretcher.
It's not what you expected. Isn't it?
But it's the correct behavior according to the standards, because the default value of min-height
is auto
. It means that flex item cannot be smaller than the size of its content along the main axis. You can read about it here.
Therefore, just set min-height: 0
for #cropperParent
. In this case stretcher won't be able to make the cropper more than the free space, and that's what you want to get. There is the example.
Also, by the way, it's not recommended to use identifiers for styling elements. They are not intended for it.
@Daedren, any news?
Apologies for the delay, but yes, that solved it. Thank you for the quick replies, I've learned quite a few things today.
@Daedren, it's all right. You are welcome!
Hello! I'm coming across an issue when trying to use the cropper.
When a cropper with
height: 100%;
is inside a parent with an proper fixed height, it'll contract to the parent's height, this is as it should and is fine.However, if the parent's height is relative, or is a flex item, the cropper will ignore the space it is allocated.
https://codesandbox.io/s/vue-advanced-cropper-issue-169-43wvm?file=/src/App.vue
In this example, if you remove the
<cropper>
from the template, you'll see the parent has the remaining flex size since it hasflex: 1
, but the cropper was ignoring that, despite havingheight: 100%
.There's a
#cropperParent_OtherChild
withdisplay: none
there, if you hide the cropper and show that one, that follows the behavior I was expecting.