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(common): Don't warn about image distortion if fill mode is enabled #47824

Closed
wants to merge 1 commit into from
Closed
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
Expand Up @@ -367,9 +367,11 @@ export class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
assertEmptyWidthAndHeight(this);
} else {
assertNonEmptyWidthAndHeight(this);
// Only check for distorted images when not in fill mode, where
// images may be intentionally stretched, cropped or letterboxed.
assertNoImageDistortion(this, this.imgElement, this.renderer);
atcastle marked this conversation as resolved.
Show resolved Hide resolved
}
assertValidLoadingInput(this);
assertNoImageDistortion(this, this.imgElement, this.renderer);
if (!this.ngSrcset) {
assertNoComplexSizes(this);
}
Expand Down
Expand Up @@ -36,6 +36,10 @@ import {Component} from '@angular/core';
<!-- Aspect-ratio: 1.0652173913 -->
<img ngSrc="/e2e/b.png" width="245" height="230">
<br>
<!-- Fill mode disables aspect ratio warning -->
<!-- Aspect-ratio: 0.1 -->
<img ngSrc="/e2e/b.png" width="24" height="240" disableOptimizedSrcset fill>
<br>
<!-- Supplied aspect ratio is correct & image has 0x0 rendered size -->
<img ngSrc="/e2e/a.png" width="25" height="25" style="display: none">
<br>
Expand Down