1 line
118 KiB
Plaintext
1 line
118 KiB
Plaintext
|
{"version":3,"file":"ngx-image-cropper.mjs","sources":["../../../projects/ngx-image-cropper/src/lib/interfaces/cropper.settings.ts","../../../projects/ngx-image-cropper/src/lib/interfaces/move-start.interface.ts","../../../projects/ngx-image-cropper/src/lib/utils/keyboard.utils.ts","../../../projects/ngx-image-cropper/src/lib/utils/resize.utils.ts","../../../projects/ngx-image-cropper/src/lib/utils/percentage.utils.ts","../../../projects/ngx-image-cropper/src/lib/services/crop.service.ts","../../../projects/ngx-image-cropper/src/lib/services/cropper-position.service.ts","../../../projects/ngx-image-cropper/src/lib/utils/exif.utils.ts","../../../projects/ngx-image-cropper/src/lib/services/load-image.service.ts","../../../projects/ngx-image-cropper/src/lib/component/image-cropper.component.ts","../../../projects/ngx-image-cropper/src/lib/component/image-cropper.component.html","../../../projects/ngx-image-cropper/src/lib/image-cropper.module.ts","../../../projects/ngx-image-cropper/src/lib/utils/blob.utils.ts","../../../projects/ngx-image-cropper/src/ngx-image-cropper.ts"],"sourcesContent":["import { CropperOptions, OutputFormat, OutputType } from './cropper-options.interface';\nimport { ImageTransform } from './image-transform.interface';\nimport { SimpleChanges } from '@angular/core';\n\nexport class CropperSettings {\n\n // From options\n format: OutputFormat = 'png';\n output: OutputType = 'blob';\n maintainAspectRatio = true;\n transform: ImageTransform = {};\n aspectRatio = 1;\n resetCropOnAspectRatioChange = true;\n resizeToWidth = 0;\n resizeToHeight = 0;\n cropperMinWidth = 0;\n cropperMinHeight = 0;\n cropperMaxHeight = 0;\n cropperMaxWidth = 0;\n cropperStaticWidth = 0;\n cropperStaticHeight = 0;\n canvasRotation = 0;\n initialStepSize = 3;\n roundCropper = false;\n onlyScaleDown = false;\n imageQuality = 92;\n autoCrop = true;\n backgroundColor: string | null = null;\n containWithinAspectRatio = false;\n hideResizeSquares = false;\n alignImage: 'left' | 'center' = 'center';\n cropperFrameAriaLabel = 'Crop photo';\n\n // Internal\n cropperScaledMinWidth = 20;\n cropperScaledMinHeight = 20;\n cropperScaledMaxWidth = 20;\n cropperScaledMaxHeight = 20;\n stepSize = this.initialStepSize;\n\n setOptions(options: Partial<CropperOptions>): void {\n Object.keys(options)\n .filter((k) => k in this)\n .forEach((k) => (this as any)[k] = (options as any)[k]);\n this.validateOptions();\n }\n\n setOptionsFromChanges(changes: SimpleChanges): void {\n Object.keys(changes)\n .filter((k) => k in this)\n .forEach((k) => (this as any)[k] = changes[k].currentValue);\n this.validateOptions();\n }\n\n private validateOptions(): void {\n if (this.maintainAspectRatio && !this.aspectRatio) {\n throw new Error('`aspectRatio` should > 0 when `maintainAspectRatio` is enabled');\n }\n }\n}\n","import { ImageTransform } from './image-transform.interface';\n\nexport interface MoveStart {\n active: boolean;\n type: MoveTypes | null;\n position: string | null;\n transform?: ImageTransform;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n clientX: number;\n clientY: number;\n}\n\nexport enum MoveTypes {\n Drag = 'drag',\n Move = 'move',\n Resize = 'resize',\n Pinch = 'pinch'\n}\n","export function getPositionForKey(key: string): string {\n switch (key) {\n case 'ArrowUp':\n return 'top';\n case 'ArrowRight':\n return 'right';\n case 'ArrowDown':\n return 'bottom';\n case 'ArrowLeft':\n default:\n return 'left';\n }\n}\n\nexport function getInvertedPositionForKey(key: string): string {\n switch (key) {\n case 'ArrowUp':\n return 'bottom';\n case 'ArrowRight':\n return 'left';\n case 'ArrowDown':\n return 'top';\n case 'ArrowLeft':\n default:\n return 'right';\n }\n}\n\nexport function getEventForKey(key: string, stepSize: number): any {\n switch (key) {\n case 'ArrowUp':\n return {clientX: 0, clientY: stepSize * -1};\n case 'ArrowRight':\n return {clientX
|