Skip to content

Commit

Permalink
fix(common): Don't warn about image distortion is fill mode is enabled
Browse files Browse the repository at this point in the history
The image distortion warning (when rendered aspect ratio is noticeably different than intrinsic) doesn't make sense with fill mode, where the user may want the image to stretch, crop or letterbox.
  • Loading branch information
atcastle committed Oct 20, 2022
1 parent 883b32c commit b8a6d84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -367,9 +367,9 @@ export class NgOptimizedImage implements OnInit, OnChanges, OnDestroy {
assertEmptyWidthAndHeight(this);
} else {
assertNonEmptyWidthAndHeight(this);
assertNoImageDistortion(this, this.imgElement, this.renderer);
}
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

0 comments on commit b8a6d84

Please sign in to comment.