Skip to content
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

fix: change object-fit of UploadList to contain #27312

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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