117 lines
5.8 KiB
TypeScript
117 lines
5.8 KiB
TypeScript
import { ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
import { DomSanitizer, HammerLoader, SafeStyle, SafeUrl } from '@angular/platform-browser';
|
|
import { CropperPosition, Dimensions, ImageCroppedEvent, ImageTransform, LoadedImage } from '../interfaces';
|
|
import { OutputFormat } from '../interfaces/cropper-options.interface';
|
|
import { MoveTypes } from '../interfaces/move-start.interface';
|
|
import { CropService } from '../services/crop.service';
|
|
import { CropperPositionService } from '../services/cropper-position.service';
|
|
import { LoadImageService } from '../services/load-image.service';
|
|
import * as i0 from "@angular/core";
|
|
export declare class ImageCropperComponent implements OnChanges, OnInit {
|
|
private cropService;
|
|
private cropperPositionService;
|
|
private loadImageService;
|
|
private sanitizer;
|
|
private cd;
|
|
private zone;
|
|
private readonly hammerLoader;
|
|
private settings;
|
|
private setImageMaxSizeRetries;
|
|
private moveStart?;
|
|
private loadedImage?;
|
|
private resizedWhileHidden;
|
|
safeImgDataUrl?: SafeUrl | string;
|
|
safeTransformStyle?: SafeStyle | string;
|
|
marginLeft: SafeStyle | string;
|
|
maxSize: Dimensions;
|
|
moveTypes: typeof MoveTypes;
|
|
imageVisible: boolean;
|
|
wrapper: ElementRef<HTMLDivElement>;
|
|
sourceImage: ElementRef<HTMLDivElement>;
|
|
imageChangedEvent?: any;
|
|
imageURL?: string;
|
|
imageBase64?: string;
|
|
imageFile?: File;
|
|
imageAltText?: string;
|
|
cropperFrameAriaLabel: string;
|
|
output: 'blob' | 'base64';
|
|
format: OutputFormat;
|
|
transform: ImageTransform;
|
|
maintainAspectRatio: boolean;
|
|
aspectRatio: number;
|
|
resetCropOnAspectRatioChange: boolean;
|
|
resizeToWidth: number;
|
|
resizeToHeight: number;
|
|
cropperMinWidth: number;
|
|
cropperMinHeight: number;
|
|
cropperMaxHeight: number;
|
|
cropperMaxWidth: number;
|
|
cropperStaticWidth: number;
|
|
cropperStaticHeight: number;
|
|
canvasRotation: number;
|
|
initialStepSize: number;
|
|
roundCropper: boolean;
|
|
onlyScaleDown: boolean;
|
|
imageQuality: number;
|
|
autoCrop: boolean;
|
|
backgroundColor: string | null;
|
|
containWithinAspectRatio: boolean;
|
|
hideResizeSquares: boolean;
|
|
allowMoveImage: boolean;
|
|
cropper: CropperPosition;
|
|
alignImage: 'left' | 'center';
|
|
disabled: boolean;
|
|
hidden: boolean;
|
|
imageCropped: EventEmitter<ImageCroppedEvent>;
|
|
startCropImage: EventEmitter<void>;
|
|
imageLoaded: EventEmitter<LoadedImage>;
|
|
cropperReady: EventEmitter<Dimensions>;
|
|
loadImageFailed: EventEmitter<void>;
|
|
transformChange: EventEmitter<ImageTransform>;
|
|
constructor(cropService: CropService, cropperPositionService: CropperPositionService, loadImageService: LoadImageService, sanitizer: DomSanitizer, cd: ChangeDetectorRef, zone: NgZone, hammerLoader: HammerLoader | null);
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
private onChangesUpdateSettings;
|
|
private onChangesInputImage;
|
|
private isValidImageChangedEvent;
|
|
private setCssTransform;
|
|
ngOnInit(): void;
|
|
private reset;
|
|
private loadImageFile;
|
|
private loadBase64Image;
|
|
private loadImageFromURL;
|
|
private setLoadedImage;
|
|
loadImageError(error: any): void;
|
|
imageLoadedInView(): void;
|
|
private checkImageMaxSizeRecursively;
|
|
private sourceImageLoaded;
|
|
onResize(): void;
|
|
private activatePinchGesture;
|
|
private resizeCropperPosition;
|
|
resetCropperPosition(): void;
|
|
keyboardAccess(event: KeyboardEvent): void;
|
|
private changeKeyboardStepSize;
|
|
private keyboardMoveCropper;
|
|
startMove(event: any, moveType: MoveTypes, position?: string | null): void;
|
|
private initMouseMove;
|
|
startPinch(event: any): void;
|
|
private handleMouseMove;
|
|
onPinch(event: any): void;
|
|
private setMaxSize;
|
|
private setCropperScaledMinSize;
|
|
private setCropperScaledMinWidth;
|
|
private setCropperScaledMinHeight;
|
|
private setCropperScaledMaxSize;
|
|
private checkCropperPosition;
|
|
private handleMouseUp;
|
|
pinchStop(): void;
|
|
private doAutoCrop;
|
|
crop(): ImageCroppedEvent | null;
|
|
crop(output: 'base64'): ImageCroppedEvent | null;
|
|
crop(output: 'blob'): Promise<ImageCroppedEvent> | null;
|
|
private cropToBlob;
|
|
private cropToBase64;
|
|
private aspectRatioIsCorrect;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<ImageCropperComponent, [null, null, null, null, null, null, { optional: true; }]>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<ImageCropperComponent, "image-cropper", never, { "imageChangedEvent": "imageChangedEvent"; "imageURL": "imageURL"; "imageBase64": "imageBase64"; "imageFile": "imageFile"; "imageAltText": "imageAltText"; "cropperFrameAriaLabel": "cropperFrameAriaLabel"; "output": "output"; "format": "format"; "transform": "transform"; "maintainAspectRatio": "maintainAspectRatio"; "aspectRatio": "aspectRatio"; "resetCropOnAspectRatioChange": "resetCropOnAspectRatioChange"; "resizeToWidth": "resizeToWidth"; "resizeToHeight": "resizeToHeight"; "cropperMinWidth": "cropperMinWidth"; "cropperMinHeight": "cropperMinHeight"; "cropperMaxHeight": "cropperMaxHeight"; "cropperMaxWidth": "cropperMaxWidth"; "cropperStaticWidth": "cropperStaticWidth"; "cropperStaticHeight": "cropperStaticHeight"; "canvasRotation": "canvasRotation"; "initialStepSize": "initialStepSize"; "roundCropper": "roundCropper"; "onlyScaleDown": "onlyScaleDown"; "imageQuality": "imageQuality"; "autoCrop": "autoCrop"; "backgroundColor": "backgroundColor"; "containWithinAspectRatio": "containWithinAspectRatio"; "hideResizeSquares": "hideResizeSquares"; "allowMoveImage": "allowMoveImage"; "cropper": "cropper"; "alignImage": "alignImage"; "disabled": "disabled"; "hidden": "hidden"; }, { "imageCropped": "imageCropped"; "startCropImage": "startCropImage"; "imageLoaded": "imageLoaded"; "cropperReady": "cropperReady"; "loadImageFailed": "loadImageFailed"; "transformChange": "transformChange"; }, never, never>;
|
|
}
|