Fixed an issue where image cropping didn't always work correctly.

This commit is contained in:
Leon Styhre 2023-03-02 18:14:01 +01:00
parent 016bc4f590
commit 0aae28c7a4

View file

@ -202,6 +202,9 @@ void ImageComponent::coverFitCrop()
{ {
assert(mTargetIsCrop); assert(mTargetIsCrop);
mTopLeftCrop = {0.0f, 0.0f};
mBottomRightCrop = {1.0f, 1.0f};
if (std::round(mSize.y) > std::round(mTargetSize.y)) { if (std::round(mSize.y) > std::round(mTargetSize.y)) {
const float cropSize {1.0f - (mTargetSize.y / mSize.y)}; const float cropSize {1.0f - (mTargetSize.y / mSize.y)};
cropTop(cropSize / 2.0f); cropTop(cropSize / 2.0f);