Skip to content

Commit

Permalink
Add autoCrop to CropperOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mawi137 committed Jun 5, 2024
1 parent b156496 commit cfb7955
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class CropperState {
options: CropperOptions = {
format: 'png',
output: 'blob',
autoCrop: true,
maintainAspectRatio: true,
aspectRatio: 1,
resetCropOnAspectRatioChange: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class ImageCropperComponent implements OnChanges, OnInit {
@Input() cropperFrameAriaLabel?: string;
@Input() output?: 'blob' | 'base64';
@Input() format?: OutputFormat;
@Input() autoCrop?: boolean;
@Input() cropper?: CropperPosition;
@Input() transform?: ImageTransform;
@Input() maintainAspectRatio?: boolean;
Expand All @@ -106,8 +107,6 @@ export class ImageCropperComponent implements OnChanges, OnInit {
@Input() allowMoveImage = false;
@Input() alignImage?: 'left' | 'center';

@Input() autoCrop = true;

@HostBinding('class.disabled')
@Input() disabled = false;
@HostBinding('class.ngx-ic-hidden')
Expand Down Expand Up @@ -519,7 +518,7 @@ export class ImageCropperComponent implements OnChanges, OnInit {
}

private doAutoCrop(): void {
if (this.autoCrop) {
if (this.state.options.autoCrop) {
void this.crop();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface CropperOptions {
format: OutputFormat;
output: OutputType;
autoCrop: boolean;
maintainAspectRatio: boolean;
resetCropOnAspectRatioChange: boolean;
aspectRatio: number;
Expand Down

0 comments on commit cfb7955

Please sign in to comment.