Skip to content

Commit

Permalink
feat: change object-fit of UploadList to contain (#27312)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorTour committed Oct 23, 2020
1 parent 6e0981d commit 75d4fdb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/upload/__tests__/uploadlist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion components/upload/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-fit: contain;
}

.@{upload-item}-name {
Expand Down
2 changes: 1 addition & 1 deletion components/upload/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 75d4fdb

Please sign in to comment.