feat: change object-fit of UploadList to contain (#27312)

This commit is contained in:
JuniorTour 2020-10-23 11:18:57 +08:00 committed by GitHub
parent 6e0981d1df
commit 75d4fdb3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -364,9 +364,9 @@ describe('Upload List', () => {
// Offset check
const [, offsetX, offsetY] = onDrawImage.mock.calls[0];
if (width > height) {
expect(offsetX < 0).toBeTruthy();
expect(offsetX === 0).toBeTruthy();
} else {
expect(offsetY < 0).toBeTruthy();
expect(offsetY === 0).toBeTruthy();
}
});
});

View File

@ -475,7 +475,7 @@
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-fit: contain;
}
.@{upload-item}-name {

View File

@ -90,7 +90,7 @@ export function previewImage(file: File | Blob): Promise<string> {
let offsetX = 0;
let offsetY = 0;
if (width < height) {
if (width > height) {
drawHeight = height * (MEASURE_SIZE / width);
offsetY = -(drawHeight - drawWidth) / 2;
} else {