ngx-image-cropper 9.1.1 → 9.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/component/cropper.state.mjs +27 -17
- package/esm2022/lib/component/image-cropper.component.mjs +9 -9
- package/esm2022/lib/interfaces/crop-input.interface.mjs +2 -0
- package/esm2022/lib/interfaces/cropper-options.interface.mjs +1 -1
- package/esm2022/lib/interfaces/index.mjs +1 -1
- package/esm2022/lib/services/crop.service.mjs +51 -54
- package/esm2022/lib/utils/cropper-position.utils.mjs +29 -29
- package/fesm2022/ngx-image-cropper.mjs +112 -105
- package/fesm2022/ngx-image-cropper.mjs.map +1 -1
- package/lib/component/cropper.state.d.ts +3 -3
- package/lib/interfaces/crop-input.interface.d.ts +23 -0
- package/lib/interfaces/cropper-options.interface.d.ts +1 -1
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/services/crop.service.d.ts +12 -6
- package/package.json +1 -1
|
@@ -15,18 +15,18 @@ function checkCropperSizeRestriction(cropperPosition, cropperState) {
|
|
|
15
15
|
const centerX = cropperPosition.x1 + cropperWidth / 2;
|
|
16
16
|
const centerY = cropperPosition.y1 + cropperHeight / 2;
|
|
17
17
|
if (cropperState.options.cropperStaticHeight && cropperState.options.cropperStaticWidth) {
|
|
18
|
-
cropperWidth = cropperState.maxSize.width > cropperState.options.cropperStaticWidth
|
|
18
|
+
cropperWidth = cropperState.maxSize().width > cropperState.options.cropperStaticWidth
|
|
19
19
|
? cropperState.options.cropperStaticWidth
|
|
20
|
-
: cropperState.maxSize.width;
|
|
21
|
-
cropperHeight = cropperState.maxSize.height > cropperState.options.cropperStaticHeight
|
|
20
|
+
: cropperState.maxSize().width;
|
|
21
|
+
cropperHeight = cropperState.maxSize().height > cropperState.options.cropperStaticHeight
|
|
22
22
|
? cropperState.options.cropperStaticHeight
|
|
23
|
-
: cropperState.maxSize.height;
|
|
23
|
+
: cropperState.maxSize().height;
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
cropperWidth = Math.max(cropperState.cropperScaledMinWidth, Math.min(cropperWidth, cropperState.cropperScaledMaxWidth, cropperState.maxSize.width));
|
|
27
|
-
cropperHeight = Math.max(cropperState.cropperScaledMinHeight, Math.min(cropperHeight, cropperState.cropperScaledMaxHeight, cropperState.maxSize.height));
|
|
26
|
+
cropperWidth = Math.max(cropperState.cropperScaledMinWidth, Math.min(cropperWidth, cropperState.cropperScaledMaxWidth, cropperState.maxSize().width));
|
|
27
|
+
cropperHeight = Math.max(cropperState.cropperScaledMinHeight, Math.min(cropperHeight, cropperState.cropperScaledMaxHeight, cropperState.maxSize().height));
|
|
28
28
|
if (cropperState.options.maintainAspectRatio) {
|
|
29
|
-
if (cropperState.maxSize.width / cropperState.options.aspectRatio < cropperState.maxSize.height) {
|
|
29
|
+
if (cropperState.maxSize().width / cropperState.options.aspectRatio < cropperState.maxSize().height) {
|
|
30
30
|
cropperHeight = cropperWidth / cropperState.options.aspectRatio;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -55,18 +55,18 @@ function checkCropperWithinMaxSizeBounds(position, cropperState, maintainSize =
|
|
|
55
55
|
y1: 0
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
if (position.x2 > cropperState.maxSize.width) {
|
|
58
|
+
if (position.x2 > cropperState.maxSize().width) {
|
|
59
59
|
position = {
|
|
60
60
|
...position,
|
|
61
|
-
x1: position.x1 - (maintainSize ? (position.x2 - cropperState.maxSize.width) : 0),
|
|
62
|
-
x2: cropperState.maxSize.width
|
|
61
|
+
x1: position.x1 - (maintainSize ? (position.x2 - cropperState.maxSize().width) : 0),
|
|
62
|
+
x2: cropperState.maxSize().width
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
if (position.y2 > cropperState.maxSize.height) {
|
|
65
|
+
if (position.y2 > cropperState.maxSize().height) {
|
|
66
66
|
position = {
|
|
67
67
|
...position,
|
|
68
|
-
y1: position.y1 - (maintainSize ? (position.y2 - cropperState.maxSize.height) : 0),
|
|
69
|
-
y2: cropperState.maxSize.height
|
|
68
|
+
y1: position.y1 - (maintainSize ? (position.y2 - cropperState.maxSize().height) : 0),
|
|
69
|
+
y2: cropperState.maxSize().height
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
return position;
|
|
@@ -126,17 +126,17 @@ function resizeCropper(event, moveStart, cropperState) {
|
|
|
126
126
|
cropperPosition.x2 -= cropperPosition.x1;
|
|
127
127
|
cropperPosition.x1 = 0;
|
|
128
128
|
}
|
|
129
|
-
else if (cropperPosition.x2 > cropperState.maxSize.width) {
|
|
130
|
-
cropperPosition.x1 -= (cropperPosition.x2 - cropperState.maxSize.width);
|
|
131
|
-
cropperPosition.x2 = cropperState.maxSize.width;
|
|
129
|
+
else if (cropperPosition.x2 > cropperState.maxSize().width) {
|
|
130
|
+
cropperPosition.x1 -= (cropperPosition.x2 - cropperState.maxSize().width);
|
|
131
|
+
cropperPosition.x2 = cropperState.maxSize().width;
|
|
132
132
|
}
|
|
133
133
|
if (cropperPosition.y1 < 0) {
|
|
134
134
|
cropperPosition.y2 -= cropperPosition.y1;
|
|
135
135
|
cropperPosition.y1 = 0;
|
|
136
136
|
}
|
|
137
|
-
else if (cropperPosition.y2 > cropperState.maxSize.height) {
|
|
138
|
-
cropperPosition.y1 -= (cropperPosition.y2 - cropperState.maxSize.height);
|
|
139
|
-
cropperPosition.y2 = cropperState.maxSize.height;
|
|
137
|
+
else if (cropperPosition.y2 > cropperState.maxSize().height) {
|
|
138
|
+
cropperPosition.y1 -= (cropperPosition.y2 - cropperState.maxSize().height);
|
|
139
|
+
cropperPosition.y2 = cropperState.maxSize().height;
|
|
140
140
|
}
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
@@ -154,7 +154,7 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
154
154
|
switch (position) {
|
|
155
155
|
case 'top':
|
|
156
156
|
cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * cropperState.options.aspectRatio;
|
|
157
|
-
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize.width, 0);
|
|
157
|
+
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize().width, 0);
|
|
158
158
|
overflowY = Math.max(0 - cropperPosition.y1, 0);
|
|
159
159
|
if (overflowX > 0 || overflowY > 0) {
|
|
160
160
|
cropperPosition.x2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? (overflowY * cropperState.options.aspectRatio) : overflowX;
|
|
@@ -163,8 +163,8 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
163
163
|
break;
|
|
164
164
|
case 'bottom':
|
|
165
165
|
cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * cropperState.options.aspectRatio;
|
|
166
|
-
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize.width, 0);
|
|
167
|
-
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize.height, 0);
|
|
166
|
+
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize().width, 0);
|
|
167
|
+
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize().height, 0);
|
|
168
168
|
if (overflowX > 0 || overflowY > 0) {
|
|
169
169
|
cropperPosition.x2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? (overflowY * cropperState.options.aspectRatio) : overflowX;
|
|
170
170
|
cropperPosition.y2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? overflowY : (overflowX / cropperState.options.aspectRatio);
|
|
@@ -181,7 +181,7 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
181
181
|
break;
|
|
182
182
|
case 'topright':
|
|
183
183
|
cropperPosition.y1 = cropperPosition.y2 - (cropperPosition.x2 - cropperPosition.x1) / cropperState.options.aspectRatio;
|
|
184
|
-
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize.width, 0);
|
|
184
|
+
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize().width, 0);
|
|
185
185
|
overflowY = Math.max(0 - cropperPosition.y1, 0);
|
|
186
186
|
if (overflowX > 0 || overflowY > 0) {
|
|
187
187
|
cropperPosition.x2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? (overflowY * cropperState.options.aspectRatio) : overflowX;
|
|
@@ -191,8 +191,8 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
191
191
|
case 'right':
|
|
192
192
|
case 'bottomright':
|
|
193
193
|
cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / cropperState.options.aspectRatio;
|
|
194
|
-
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize.width, 0);
|
|
195
|
-
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize.height, 0);
|
|
194
|
+
overflowX = Math.max(cropperPosition.x2 - cropperState.maxSize().width, 0);
|
|
195
|
+
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize().height, 0);
|
|
196
196
|
if (overflowX > 0 || overflowY > 0) {
|
|
197
197
|
cropperPosition.x2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? (overflowY * cropperState.options.aspectRatio) : overflowX;
|
|
198
198
|
cropperPosition.y2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? overflowY : overflowX / cropperState.options.aspectRatio;
|
|
@@ -202,7 +202,7 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
202
202
|
case 'bottomleft':
|
|
203
203
|
cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / cropperState.options.aspectRatio;
|
|
204
204
|
overflowX = Math.max(0 - cropperPosition.x1, 0);
|
|
205
|
-
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize.height, 0);
|
|
205
|
+
overflowY = Math.max(cropperPosition.y2 - cropperState.maxSize().height, 0);
|
|
206
206
|
if (overflowX > 0 || overflowY > 0) {
|
|
207
207
|
cropperPosition.x1 += (overflowY * cropperState.options.aspectRatio) > overflowX ? (overflowY * cropperState.options.aspectRatio) : overflowX;
|
|
208
208
|
cropperPosition.y2 -= (overflowY * cropperState.options.aspectRatio) > overflowX ? overflowY : overflowX / cropperState.options.aspectRatio;
|
|
@@ -212,8 +212,8 @@ function checkAspectRatio(position, cropperPosition, cropperState) {
|
|
|
212
212
|
cropperPosition.x2 = cropperPosition.x1 + (cropperPosition.y2 - cropperPosition.y1) * cropperState.options.aspectRatio;
|
|
213
213
|
cropperPosition.y2 = cropperPosition.y1 + (cropperPosition.x2 - cropperPosition.x1) / cropperState.options.aspectRatio;
|
|
214
214
|
const overflowX1 = Math.max(0 - cropperPosition.x1, 0);
|
|
215
|
-
const overflowX2 = Math.max(cropperPosition.x2 - cropperState.maxSize.width, 0);
|
|
216
|
-
const overflowY1 = Math.max(cropperPosition.y2 - cropperState.maxSize.height, 0);
|
|
215
|
+
const overflowX2 = Math.max(cropperPosition.x2 - cropperState.maxSize().width, 0);
|
|
216
|
+
const overflowY1 = Math.max(cropperPosition.y2 - cropperState.maxSize().height, 0);
|
|
217
217
|
const overflowY2 = Math.max(0 - cropperPosition.y1, 0);
|
|
218
218
|
if (overflowX1 > 0 || overflowX2 > 0 || overflowY1 > 0 || overflowY2 > 0) {
|
|
219
219
|
cropperPosition.x1 += (overflowY1 * cropperState.options.aspectRatio) > overflowX1 ? (overflowY1 * cropperState.options.aspectRatio) : overflowX1;
|
|
@@ -247,6 +247,7 @@ function getClientY(event) {
|
|
|
247
247
|
class CropperState {
|
|
248
248
|
constructor() {
|
|
249
249
|
this.cropper = signal({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
250
|
+
this.maxSize = signal({ width: 0, height: 0 });
|
|
250
251
|
this.transform = {};
|
|
251
252
|
this.options = {
|
|
252
253
|
format: 'png',
|
|
@@ -267,7 +268,7 @@ class CropperState {
|
|
|
267
268
|
roundCropper: false,
|
|
268
269
|
onlyScaleDown: false,
|
|
269
270
|
imageQuality: 92,
|
|
270
|
-
backgroundColor:
|
|
271
|
+
backgroundColor: undefined,
|
|
271
272
|
containWithinAspectRatio: false,
|
|
272
273
|
hideResizeSquares: false,
|
|
273
274
|
alignImage: 'center',
|
|
@@ -336,7 +337,7 @@ class CropperState {
|
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
339
|
setMaxSize(width, height) {
|
|
339
|
-
this.maxSize
|
|
340
|
+
this.maxSize.set({ width, height });
|
|
340
341
|
this.setCropperScaledMinSize();
|
|
341
342
|
this.setCropperScaledMaxSize();
|
|
342
343
|
}
|
|
@@ -352,7 +353,7 @@ class CropperState {
|
|
|
352
353
|
}
|
|
353
354
|
setCropperScaledMinWidth() {
|
|
354
355
|
this.cropperScaledMinWidth = this.options.cropperMinWidth > 0
|
|
355
|
-
? Math.max(20, this.options.cropperMinWidth / this.loadedImage.transformed.size.width * this.maxSize.width)
|
|
356
|
+
? Math.max(20, this.options.cropperMinWidth / this.loadedImage.transformed.size.width * this.maxSize().width)
|
|
356
357
|
: 20;
|
|
357
358
|
}
|
|
358
359
|
setCropperScaledMinHeight() {
|
|
@@ -360,7 +361,7 @@ class CropperState {
|
|
|
360
361
|
this.cropperScaledMinHeight = Math.max(20, this.cropperScaledMinWidth / this.options.aspectRatio);
|
|
361
362
|
}
|
|
362
363
|
else if (this.options.cropperMinHeight > 0) {
|
|
363
|
-
this.cropperScaledMinHeight = Math.max(20, this.options.cropperMinHeight / this.loadedImage.transformed.size.height * this.maxSize.height);
|
|
364
|
+
this.cropperScaledMinHeight = Math.max(20, this.options.cropperMinHeight / this.loadedImage.transformed.size.height * this.maxSize().height);
|
|
364
365
|
}
|
|
365
366
|
else {
|
|
366
367
|
this.cropperScaledMinHeight = 20;
|
|
@@ -368,9 +369,9 @@ class CropperState {
|
|
|
368
369
|
}
|
|
369
370
|
setCropperScaledMaxSize() {
|
|
370
371
|
if (this.loadedImage?.transformed.size) {
|
|
371
|
-
const ratio = this.loadedImage.transformed.size.width / this.maxSize.width;
|
|
372
|
-
this.cropperScaledMaxWidth = this.options.cropperMaxWidth > 20 ? this.options.cropperMaxWidth / ratio : this.maxSize.width;
|
|
373
|
-
this.cropperScaledMaxHeight = this.options.cropperMaxHeight > 20 ? this.options.cropperMaxHeight / ratio : this.maxSize.height;
|
|
372
|
+
const ratio = this.loadedImage.transformed.size.width / this.maxSize().width;
|
|
373
|
+
this.cropperScaledMaxWidth = this.options.cropperMaxWidth > 20 ? this.options.cropperMaxWidth / ratio : this.maxSize().width;
|
|
374
|
+
this.cropperScaledMaxHeight = this.options.cropperMaxHeight > 20 ? this.options.cropperMaxHeight / ratio : this.maxSize().height;
|
|
374
375
|
if (this.options.maintainAspectRatio) {
|
|
375
376
|
if (this.cropperScaledMaxWidth > this.cropperScaledMaxHeight * this.options.aspectRatio) {
|
|
376
377
|
this.cropperScaledMaxWidth = this.cropperScaledMaxHeight * this.options.aspectRatio;
|
|
@@ -381,8 +382,8 @@ class CropperState {
|
|
|
381
382
|
}
|
|
382
383
|
}
|
|
383
384
|
else {
|
|
384
|
-
this.cropperScaledMaxWidth = this.maxSize.width;
|
|
385
|
-
this.cropperScaledMaxHeight = this.maxSize.height;
|
|
385
|
+
this.cropperScaledMaxWidth = this.maxSize().width;
|
|
386
|
+
this.cropperScaledMaxHeight = this.maxSize().height;
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
equalsCropperPosition(cropper) {
|
|
@@ -411,12 +412,12 @@ class CropperState {
|
|
|
411
412
|
return currentCropAspectRatio === this.options.aspectRatio;
|
|
412
413
|
}
|
|
413
414
|
resizeCropperPosition(oldMaxSize) {
|
|
414
|
-
if (oldMaxSize.width !== this.maxSize.width || oldMaxSize.height !== this.maxSize.height) {
|
|
415
|
+
if (oldMaxSize.width !== this.maxSize().width || oldMaxSize.height !== this.maxSize().height) {
|
|
415
416
|
this.cropper.update(cropper => ({
|
|
416
|
-
x1: cropper.x1 * this.maxSize.width / oldMaxSize.width,
|
|
417
|
-
x2: cropper.x2 * this.maxSize.width / oldMaxSize.width,
|
|
418
|
-
y1: cropper.y1 * this.maxSize.height / oldMaxSize.height,
|
|
419
|
-
y2: cropper.y2 * this.maxSize.height / oldMaxSize.height
|
|
417
|
+
x1: cropper.x1 * this.maxSize().width / oldMaxSize.width,
|
|
418
|
+
x2: cropper.x2 * this.maxSize().width / oldMaxSize.width,
|
|
419
|
+
y1: cropper.y1 * this.maxSize().height / oldMaxSize.height,
|
|
420
|
+
y2: cropper.y2 * this.maxSize().height / oldMaxSize.height
|
|
420
421
|
}));
|
|
421
422
|
}
|
|
422
423
|
}
|
|
@@ -424,8 +425,17 @@ class CropperState {
|
|
|
424
425
|
return {
|
|
425
426
|
x1: 0,
|
|
426
427
|
y1: 0,
|
|
427
|
-
x2: this.maxSize.width,
|
|
428
|
-
y2: this.maxSize.height
|
|
428
|
+
x2: this.maxSize().width,
|
|
429
|
+
y2: this.maxSize().height
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
toCropInput() {
|
|
433
|
+
return {
|
|
434
|
+
cropper: this.cropper(),
|
|
435
|
+
maxSize: this.maxSize(),
|
|
436
|
+
transform: this.transform,
|
|
437
|
+
loadedImage: this.loadedImage,
|
|
438
|
+
options: { ...this.options }
|
|
429
439
|
};
|
|
430
440
|
}
|
|
431
441
|
}
|
|
@@ -518,8 +528,8 @@ function percentage(percent, totalValue) {
|
|
|
518
528
|
}
|
|
519
529
|
|
|
520
530
|
class CropService {
|
|
521
|
-
crop(
|
|
522
|
-
const imagePosition = this.getImagePosition(
|
|
531
|
+
crop(input, output) {
|
|
532
|
+
const imagePosition = this.getImagePosition(input);
|
|
523
533
|
const width = imagePosition.x2 - imagePosition.x1;
|
|
524
534
|
const height = imagePosition.y2 - imagePosition.y1;
|
|
525
535
|
const cropCanvas = document.createElement('canvas');
|
|
@@ -529,77 +539,76 @@ class CropService {
|
|
|
529
539
|
if (!ctx) {
|
|
530
540
|
return null;
|
|
531
541
|
}
|
|
532
|
-
if (
|
|
533
|
-
ctx.fillStyle =
|
|
542
|
+
if (input.options?.backgroundColor != null) {
|
|
543
|
+
ctx.fillStyle = input.options.backgroundColor;
|
|
534
544
|
ctx.fillRect(0, 0, width, height);
|
|
535
545
|
}
|
|
536
|
-
const scaleX = (
|
|
537
|
-
const scaleY = (
|
|
538
|
-
const { translateH, translateV } = this.getCanvasTranslate(
|
|
539
|
-
const transformedImage =
|
|
546
|
+
const scaleX = (input.transform?.scale || 1) * (input.transform?.flipH ? -1 : 1);
|
|
547
|
+
const scaleY = (input.transform?.scale || 1) * (input.transform?.flipV ? -1 : 1);
|
|
548
|
+
const { translateH, translateV } = this.getCanvasTranslate(input);
|
|
549
|
+
const transformedImage = input.loadedImage.transformed;
|
|
540
550
|
ctx.setTransform(scaleX, 0, 0, scaleY, transformedImage.size.width / 2 + translateH, transformedImage.size.height / 2 + translateV);
|
|
541
551
|
ctx.translate(-imagePosition.x1 / scaleX, -imagePosition.y1 / scaleY);
|
|
542
|
-
ctx.rotate((
|
|
552
|
+
ctx.rotate((input.transform?.rotate || 0) * Math.PI / 180);
|
|
543
553
|
ctx.drawImage(transformedImage.image, -transformedImage.size.width / 2, -transformedImage.size.height / 2);
|
|
544
554
|
const result = {
|
|
545
555
|
width, height,
|
|
546
556
|
imagePosition,
|
|
547
|
-
cropperPosition: { ...
|
|
557
|
+
cropperPosition: { ...input.cropper }
|
|
548
558
|
};
|
|
549
|
-
if (
|
|
550
|
-
result.offsetImagePosition = this.getOffsetImagePosition(
|
|
559
|
+
if (input.options?.containWithinAspectRatio) {
|
|
560
|
+
result.offsetImagePosition = this.getOffsetImagePosition(input);
|
|
551
561
|
}
|
|
552
|
-
const resizeRatio = this.getResizeRatio(width, height,
|
|
562
|
+
const resizeRatio = this.getResizeRatio(width, height, input.options);
|
|
553
563
|
if (resizeRatio !== 1) {
|
|
554
564
|
result.width = Math.round(width * resizeRatio);
|
|
555
|
-
result.height =
|
|
556
|
-
? Math.round(result.width /
|
|
565
|
+
result.height = input.options?.maintainAspectRatio
|
|
566
|
+
? Math.round(result.width / (input.options?.aspectRatio ?? 1))
|
|
557
567
|
: Math.round(height * resizeRatio);
|
|
558
568
|
resizeCanvas(cropCanvas, result.width, result.height);
|
|
559
569
|
}
|
|
560
570
|
if (output === 'blob') {
|
|
561
|
-
return this.cropToBlob(result, cropCanvas,
|
|
571
|
+
return this.cropToBlob(result, cropCanvas, input);
|
|
562
572
|
}
|
|
563
573
|
else {
|
|
564
|
-
result.base64 = cropCanvas.toDataURL('image/' +
|
|
574
|
+
result.base64 = cropCanvas.toDataURL('image/' + (input.options?.format ?? 'png'), this.getQuality(input.options));
|
|
565
575
|
return result;
|
|
566
576
|
}
|
|
567
577
|
}
|
|
568
|
-
async cropToBlob(output, cropCanvas,
|
|
569
|
-
output.blob = await new Promise(resolve => cropCanvas.toBlob(resolve, 'image/' +
|
|
578
|
+
async cropToBlob(output, cropCanvas, input) {
|
|
579
|
+
output.blob = await new Promise(resolve => cropCanvas.toBlob(resolve, 'image/' + (input.options?.format ?? 'png'), this.getQuality(input.options)));
|
|
570
580
|
if (output.blob) {
|
|
571
581
|
output.objectUrl = URL.createObjectURL(output.blob);
|
|
572
582
|
}
|
|
573
583
|
return output;
|
|
574
584
|
}
|
|
575
|
-
getCanvasTranslate(
|
|
576
|
-
if (
|
|
577
|
-
const ratio = this.getRatio(
|
|
585
|
+
getCanvasTranslate(input) {
|
|
586
|
+
if (input.transform?.translateUnit === 'px') {
|
|
587
|
+
const ratio = this.getRatio(input);
|
|
578
588
|
return {
|
|
579
|
-
translateH: (
|
|
580
|
-
translateV: (
|
|
589
|
+
translateH: (input.transform?.translateH || 0) * ratio,
|
|
590
|
+
translateV: (input.transform?.translateV || 0) * ratio
|
|
581
591
|
};
|
|
582
592
|
}
|
|
583
593
|
else {
|
|
584
594
|
return {
|
|
585
|
-
translateH:
|
|
586
|
-
translateV:
|
|
595
|
+
translateH: input.transform?.translateH ? percentage(input.transform.translateH, input.loadedImage.transformed.size.width) : 0,
|
|
596
|
+
translateV: input.transform?.translateV ? percentage(input.transform.translateV, input.loadedImage.transformed.size.height) : 0
|
|
587
597
|
};
|
|
588
598
|
}
|
|
589
599
|
}
|
|
590
|
-
getRatio(
|
|
591
|
-
return
|
|
600
|
+
getRatio(input) {
|
|
601
|
+
return input.loadedImage.transformed.size.width / input.maxSize.width;
|
|
592
602
|
}
|
|
593
603
|
getImagePosition(cropperState) {
|
|
594
604
|
const ratio = this.getRatio(cropperState);
|
|
595
|
-
const cropper = cropperState.cropper();
|
|
596
605
|
const out = {
|
|
597
|
-
x1: Math.round(cropper.x1 * ratio),
|
|
598
|
-
y1: Math.round(cropper.y1 * ratio),
|
|
599
|
-
x2: Math.round(cropper.x2 * ratio),
|
|
600
|
-
y2: Math.round(cropper.y2 * ratio)
|
|
606
|
+
x1: Math.round(cropperState.cropper.x1 * ratio),
|
|
607
|
+
y1: Math.round(cropperState.cropper.y1 * ratio),
|
|
608
|
+
x2: Math.round(cropperState.cropper.x2 * ratio),
|
|
609
|
+
y2: Math.round(cropperState.cropper.y2 * ratio)
|
|
601
610
|
};
|
|
602
|
-
if (!cropperState.options
|
|
611
|
+
if (!cropperState.options?.containWithinAspectRatio) {
|
|
603
612
|
out.x1 = Math.max(out.x1, 0);
|
|
604
613
|
out.y1 = Math.max(out.y1, 0);
|
|
605
614
|
out.x2 = Math.min(out.x2, cropperState.loadedImage.transformed.size.width);
|
|
@@ -607,52 +616,50 @@ class CropService {
|
|
|
607
616
|
}
|
|
608
617
|
return out;
|
|
609
618
|
}
|
|
610
|
-
getOffsetImagePosition(
|
|
611
|
-
const canvasRotation =
|
|
612
|
-
const ratio = this.getRatio(
|
|
619
|
+
getOffsetImagePosition(input) {
|
|
620
|
+
const canvasRotation = (input.options?.canvasRotation ?? 0) + input.loadedImage.exifTransform.rotate;
|
|
621
|
+
const ratio = this.getRatio(input);
|
|
613
622
|
let offsetX;
|
|
614
623
|
let offsetY;
|
|
615
624
|
if (canvasRotation % 2) {
|
|
616
|
-
offsetX = (
|
|
617
|
-
offsetY = (
|
|
625
|
+
offsetX = (input.loadedImage.transformed.size.width - input.loadedImage.original.size.height) / 2;
|
|
626
|
+
offsetY = (input.loadedImage.transformed.size.height - input.loadedImage.original.size.width) / 2;
|
|
618
627
|
}
|
|
619
628
|
else {
|
|
620
|
-
offsetX = (
|
|
621
|
-
offsetY = (
|
|
629
|
+
offsetX = (input.loadedImage.transformed.size.width - input.loadedImage.original.size.width) / 2;
|
|
630
|
+
offsetY = (input.loadedImage.transformed.size.height - input.loadedImage.original.size.height) / 2;
|
|
622
631
|
}
|
|
623
|
-
const cropper =
|
|
632
|
+
const cropper = input.cropper;
|
|
624
633
|
const out = {
|
|
625
634
|
x1: Math.round(cropper.x1 * ratio) - offsetX,
|
|
626
635
|
y1: Math.round(cropper.y1 * ratio) - offsetY,
|
|
627
636
|
x2: Math.round(cropper.x2 * ratio) - offsetX,
|
|
628
637
|
y2: Math.round(cropper.y2 * ratio) - offsetY
|
|
629
638
|
};
|
|
630
|
-
if (!
|
|
639
|
+
if (!input.options?.containWithinAspectRatio) {
|
|
631
640
|
out.x1 = Math.max(out.x1, 0);
|
|
632
641
|
out.y1 = Math.max(out.y1, 0);
|
|
633
|
-
out.x2 = Math.min(out.x2,
|
|
634
|
-
out.y2 = Math.min(out.y2,
|
|
642
|
+
out.x2 = Math.min(out.x2, input.loadedImage.transformed.size.width);
|
|
643
|
+
out.y2 = Math.min(out.y2, input.loadedImage.transformed.size.height);
|
|
635
644
|
}
|
|
636
645
|
return out;
|
|
637
646
|
}
|
|
638
647
|
getResizeRatio(width, height, options) {
|
|
639
|
-
const ratioWidth = options.resizeToWidth / width;
|
|
640
|
-
const ratioHeight = options.resizeToHeight / height;
|
|
641
648
|
const ratios = new Array();
|
|
642
|
-
if (options.resizeToWidth > 0) {
|
|
643
|
-
ratios.push(
|
|
649
|
+
if (options?.resizeToWidth && options.resizeToWidth > 0) {
|
|
650
|
+
ratios.push(options.resizeToWidth / width);
|
|
644
651
|
}
|
|
645
|
-
if (options.resizeToHeight > 0) {
|
|
646
|
-
ratios.push(
|
|
652
|
+
if (options?.resizeToHeight && options.resizeToHeight > 0) {
|
|
653
|
+
ratios.push(options.resizeToHeight / height);
|
|
647
654
|
}
|
|
648
655
|
const result = ratios.length === 0 ? 1 : Math.min(...ratios);
|
|
649
|
-
if (result > 1 && !options
|
|
656
|
+
if (result > 1 && !options?.onlyScaleDown) {
|
|
650
657
|
return result;
|
|
651
658
|
}
|
|
652
659
|
return Math.min(result, 1);
|
|
653
660
|
}
|
|
654
661
|
getQuality(options) {
|
|
655
|
-
return Math.min(1, Math.max(0, options
|
|
662
|
+
return Math.min(1, Math.max(0, options?.imageQuality ?? 92 / 100));
|
|
656
663
|
}
|
|
657
664
|
}
|
|
658
665
|
|
|
@@ -1061,7 +1068,7 @@ class ImageCropperComponent {
|
|
|
1061
1068
|
}
|
|
1062
1069
|
reset() {
|
|
1063
1070
|
this.state.loadedImage = undefined;
|
|
1064
|
-
this.state.maxSize
|
|
1071
|
+
this.state.maxSize.set({ width: 0, height: 0 });
|
|
1065
1072
|
this.imageVisible = false;
|
|
1066
1073
|
}
|
|
1067
1074
|
loadImageFile(file) {
|
|
@@ -1119,7 +1126,7 @@ class ImageCropperComponent {
|
|
|
1119
1126
|
this.cropperChange.emit(this.state.cropper());
|
|
1120
1127
|
}
|
|
1121
1128
|
this.imageVisible = true;
|
|
1122
|
-
this.cropperReady.emit(
|
|
1129
|
+
this.cropperReady.emit(this.state.maxSize());
|
|
1123
1130
|
this.doAutoCrop();
|
|
1124
1131
|
}
|
|
1125
1132
|
else {
|
|
@@ -1138,7 +1145,7 @@ class ImageCropperComponent {
|
|
|
1138
1145
|
this.resizedWhileHidden = true;
|
|
1139
1146
|
}
|
|
1140
1147
|
else {
|
|
1141
|
-
const oldMaxSize =
|
|
1148
|
+
const oldMaxSize = this.state.maxSize();
|
|
1142
1149
|
this.setMaxSize();
|
|
1143
1150
|
this.state.resizeCropperPosition(oldMaxSize);
|
|
1144
1151
|
}
|
|
@@ -1297,7 +1304,7 @@ class ImageCropperComponent {
|
|
|
1297
1304
|
if (this.sourceImage) {
|
|
1298
1305
|
const sourceImageStyle = getComputedStyle(this.sourceImage.nativeElement);
|
|
1299
1306
|
this.state.setMaxSize(parseFloat(sourceImageStyle.width), parseFloat(sourceImageStyle.height));
|
|
1300
|
-
this.marginLeft = this.sanitizer.bypassSecurityTrustStyle('calc(50% - ' + this.state.maxSize.width / 2 + 'px)');
|
|
1307
|
+
this.marginLeft = this.sanitizer.bypassSecurityTrustStyle('calc(50% - ' + this.state.maxSize().width / 2 + 'px)');
|
|
1301
1308
|
}
|
|
1302
1309
|
}
|
|
1303
1310
|
emitCropperPositionChange(previousPosition) {
|
|
@@ -1324,7 +1331,7 @@ class ImageCropperComponent {
|
|
|
1324
1331
|
}
|
|
1325
1332
|
cropToBlob() {
|
|
1326
1333
|
return new Promise(async (resolve, reject) => {
|
|
1327
|
-
const result = await this.cropService.crop(this.state, 'blob');
|
|
1334
|
+
const result = await this.cropService.crop(this.state.toCropInput(), 'blob');
|
|
1328
1335
|
if (result) {
|
|
1329
1336
|
this.imageCropped.emit(result);
|
|
1330
1337
|
resolve(result);
|
|
@@ -1335,7 +1342,7 @@ class ImageCropperComponent {
|
|
|
1335
1342
|
});
|
|
1336
1343
|
}
|
|
1337
1344
|
cropToBase64() {
|
|
1338
|
-
const result = this.cropService.crop(this.state, 'base64');
|
|
1345
|
+
const result = this.cropService.crop(this.state.toCropInput(), 'base64');
|
|
1339
1346
|
if (result) {
|
|
1340
1347
|
this.imageCropped.emit(result);
|
|
1341
1348
|
return result;
|
|
@@ -1350,11 +1357,11 @@ class ImageCropperComponent {
|
|
|
1350
1357
|
this.pinchStart$.complete();
|
|
1351
1358
|
}
|
|
1352
1359
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ImageCropperComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1353
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ImageCropperComponent, isStandalone: true, selector: "image-cropper", inputs: { imageChangedEvent: "imageChangedEvent", imageURL: "imageURL", imageBase64: "imageBase64", imageFile: "imageFile", imageAltText: "imageAltText", options: "options", cropperFrameAriaLabel: "cropperFrameAriaLabel", output: "output", format: "format", autoCrop: "autoCrop", cropper: "cropper", 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", backgroundColor: "backgroundColor", containWithinAspectRatio: "containWithinAspectRatio", hideResizeSquares: "hideResizeSquares", allowMoveImage: "allowMoveImage", checkImageType: "checkImageType", alignImage: "alignImage", disabled: "disabled", hidden: "hidden" }, outputs: { imageCropped: "imageCropped", startCropImage: "startCropImage", imageLoaded: "imageLoaded", cropperReady: "cropperReady", loadImageFailed: "loadImageFailed", transformChange: "transformChange", cropperChange: "cropperChange" }, host: { listeners: { "window:resize": "onResize()" }, properties: { "class.disabled": "this.disabled", "class.ngx-ic-hidden": "this.hidden", "style.text-align": "this.alignImageStyle" } }, viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, static: true }, { propertyName: "sourceImage", first: true, predicate: ["sourceImage"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n [style.background]=\"imageVisible && state.options.backgroundColor\"\n (touchstart)=\"startPinch($event)\"\n>\n <img\n #sourceImage\n class=\"ngx-ic-source-image\"\n role=\"presentation\"\n *ngIf=\"safeImgDataUrl() as src\"\n [src]=\"src\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n [style.transform]=\"safeTransformStyle()\"\n [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n [attr.alt]=\"imageAltText\"\n (load)=\"imageLoadedInView()\"\n (mousedown)=\"startMove($event, moveTypes.Drag)\"\n (touchstart)=\"startMove($event, moveTypes.Drag)\"\n (error)=\"loadImageError($event)\"\n >\n <div\n class=\"ngx-ic-overlay\"\n [style.width.px]=\"state.maxSize?.width || 0\"\n [style.height.px]=\"state.maxSize?.height || 0\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n ></div>\n <div\n class=\"ngx-ic-cropper\"\n *ngIf=\"imageVisible\"\n [class.ngx-ic-round]=\"state.options.roundCropper\"\n [attr.aria-label]=\"state.options.cropperFrameAriaLabel\"\n [style.top.px]=\"state.cropper().y1\"\n [style.left.px]=\"state.cropper().x1\"\n [style.width.px]=\"state.cropper().x2 - state.cropper().x1\"\n [style.height.px]=\"state.cropper().y2 - state.cropper().y1\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n (keydown)=\"keyboardAccess($event)\"\n tabindex=\"0\"\n >\n <div\n (mousedown)=\"startMove($event, moveTypes.Move)\"\n (touchstart)=\"startMove($event, moveTypes.Move)\"\n class=\"ngx-ic-move\"\n role=\"presentation\">\n </div>\n <ng-container\n *ngIf=\"!state.options.hideResizeSquares && !(state.options.cropperStaticWidth && state.options.cropperStaticHeight)\">\n <span\n class=\"ngx-ic-resize ngx-ic-topleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-topright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-top\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n ></span>\n\n <span\n class=\"ngx-ic-resize ngx-ic-top\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-right\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-right\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-bottom\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottom\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-left\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-left\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n </ng-container>\n </div>\n</div>\n", styles: [":host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:var(--cropper-color, #53535C);background:transparent;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:\"\";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:var(--cropper-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper:hover .ngx-ic-move{border:var(--cropper-hover-border, var(--cropper-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper:focus .ngx-ic-move{border:var(--cropper-focus-border, 2px solid dodgerblue)}:host .ngx-ic-cropper:focus .ngx-ic-resize .ngx-ic-square{background:var(--cropper-resize-square-focus-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-focus-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;width:6px;height:6px;box-sizing:content-box;background:var(--cropper-resize-square-bg, #53535C);border:var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper .ngx-ic-resize:hover .ngx-ic-square{background:var(--cropper-resize-square-hover-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-hover-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ic-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1360
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ImageCropperComponent, isStandalone: true, selector: "image-cropper", inputs: { imageChangedEvent: "imageChangedEvent", imageURL: "imageURL", imageBase64: "imageBase64", imageFile: "imageFile", imageAltText: "imageAltText", options: "options", cropperFrameAriaLabel: "cropperFrameAriaLabel", output: "output", format: "format", autoCrop: "autoCrop", cropper: "cropper", 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", backgroundColor: "backgroundColor", containWithinAspectRatio: "containWithinAspectRatio", hideResizeSquares: "hideResizeSquares", allowMoveImage: "allowMoveImage", checkImageType: "checkImageType", alignImage: "alignImage", disabled: "disabled", hidden: "hidden" }, outputs: { imageCropped: "imageCropped", startCropImage: "startCropImage", imageLoaded: "imageLoaded", cropperReady: "cropperReady", loadImageFailed: "loadImageFailed", transformChange: "transformChange", cropperChange: "cropperChange" }, host: { listeners: { "window:resize": "onResize()" }, properties: { "class.disabled": "this.disabled", "class.ngx-ic-hidden": "this.hidden", "style.text-align": "this.alignImageStyle" } }, viewQueries: [{ propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, static: true }, { propertyName: "sourceImage", first: true, predicate: ["sourceImage"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n [style.background]=\"imageVisible && state.options.backgroundColor\"\n (touchstart)=\"startPinch($event)\"\n>\n <img\n #sourceImage\n class=\"ngx-ic-source-image\"\n role=\"presentation\"\n *ngIf=\"safeImgDataUrl() as src\"\n [src]=\"src\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n [style.transform]=\"safeTransformStyle()\"\n [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n [attr.alt]=\"imageAltText\"\n (load)=\"imageLoadedInView()\"\n (mousedown)=\"startMove($event, moveTypes.Drag)\"\n (touchstart)=\"startMove($event, moveTypes.Drag)\"\n (error)=\"loadImageError($event)\"\n >\n <div\n class=\"ngx-ic-overlay\"\n [style.width.px]=\"state.maxSize().width || 0\"\n [style.height.px]=\"state.maxSize().height || 0\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n ></div>\n <div\n class=\"ngx-ic-cropper\"\n *ngIf=\"imageVisible\"\n [class.ngx-ic-round]=\"state.options.roundCropper\"\n [attr.aria-label]=\"state.options.cropperFrameAriaLabel\"\n [style.top.px]=\"state.cropper().y1\"\n [style.left.px]=\"state.cropper().x1\"\n [style.width.px]=\"state.cropper().x2 - state.cropper().x1\"\n [style.height.px]=\"state.cropper().y2 - state.cropper().y1\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n (keydown)=\"keyboardAccess($event)\"\n tabindex=\"0\"\n >\n <div\n (mousedown)=\"startMove($event, moveTypes.Move)\"\n (touchstart)=\"startMove($event, moveTypes.Move)\"\n class=\"ngx-ic-move\"\n role=\"presentation\">\n </div>\n <ng-container\n *ngIf=\"!state.options.hideResizeSquares && !(state.options.cropperStaticWidth && state.options.cropperStaticHeight)\">\n <span\n class=\"ngx-ic-resize ngx-ic-topleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-topright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-top\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n ></span>\n\n <span\n class=\"ngx-ic-resize ngx-ic-top\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-right\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-right\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-bottom\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottom\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-left\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-left\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n </ng-container>\n </div>\n</div>\n", styles: [":host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{display:inline;max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:var(--cropper-color, #53535C);background:transparent;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:\"\";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:var(--cropper-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper:hover .ngx-ic-move{border:var(--cropper-hover-border, var(--cropper-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper:focus .ngx-ic-move{border:var(--cropper-focus-border, 2px solid dodgerblue)}:host .ngx-ic-cropper:focus .ngx-ic-resize .ngx-ic-square{background:var(--cropper-resize-square-focus-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-focus-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;width:6px;height:6px;box-sizing:content-box;background:var(--cropper-resize-square-bg, #53535C);border:var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper .ngx-ic-resize:hover .ngx-ic-square{background:var(--cropper-resize-square-hover-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-hover-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ic-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1354
1361
|
}
|
|
1355
1362
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ImageCropperComponent, decorators: [{
|
|
1356
1363
|
type: Component,
|
|
1357
|
-
args: [{ selector: 'image-cropper', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgIf], template: "<div\n [style.background]=\"imageVisible && state.options.backgroundColor\"\n (touchstart)=\"startPinch($event)\"\n>\n <img\n #sourceImage\n class=\"ngx-ic-source-image\"\n role=\"presentation\"\n *ngIf=\"safeImgDataUrl() as src\"\n [src]=\"src\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n [style.transform]=\"safeTransformStyle()\"\n [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n [attr.alt]=\"imageAltText\"\n (load)=\"imageLoadedInView()\"\n (mousedown)=\"startMove($event, moveTypes.Drag)\"\n (touchstart)=\"startMove($event, moveTypes.Drag)\"\n (error)=\"loadImageError($event)\"\n >\n <div\n class=\"ngx-ic-overlay\"\n [style.width.px]=\"state.maxSize
|
|
1364
|
+
args: [{ selector: 'image-cropper', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgIf], template: "<div\n [style.background]=\"imageVisible && state.options.backgroundColor\"\n (touchstart)=\"startPinch($event)\"\n>\n <img\n #sourceImage\n class=\"ngx-ic-source-image\"\n role=\"presentation\"\n *ngIf=\"safeImgDataUrl() as src\"\n [src]=\"src\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n [style.transform]=\"safeTransformStyle()\"\n [class.ngx-ic-draggable]=\"!disabled && allowMoveImage\"\n [attr.alt]=\"imageAltText\"\n (load)=\"imageLoadedInView()\"\n (mousedown)=\"startMove($event, moveTypes.Drag)\"\n (touchstart)=\"startMove($event, moveTypes.Drag)\"\n (error)=\"loadImageError($event)\"\n >\n <div\n class=\"ngx-ic-overlay\"\n [style.width.px]=\"state.maxSize().width || 0\"\n [style.height.px]=\"state.maxSize().height || 0\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n ></div>\n <div\n class=\"ngx-ic-cropper\"\n *ngIf=\"imageVisible\"\n [class.ngx-ic-round]=\"state.options.roundCropper\"\n [attr.aria-label]=\"state.options.cropperFrameAriaLabel\"\n [style.top.px]=\"state.cropper().y1\"\n [style.left.px]=\"state.cropper().x1\"\n [style.width.px]=\"state.cropper().x2 - state.cropper().x1\"\n [style.height.px]=\"state.cropper().y2 - state.cropper().y1\"\n [style.margin-left]=\"state.options.alignImage === 'center' ? marginLeft : null\"\n [style.visibility]=\"imageVisible ? 'visible' : 'hidden'\"\n (keydown)=\"keyboardAccess($event)\"\n tabindex=\"0\"\n >\n <div\n (mousedown)=\"startMove($event, moveTypes.Move)\"\n (touchstart)=\"startMove($event, moveTypes.Move)\"\n class=\"ngx-ic-move\"\n role=\"presentation\">\n </div>\n <ng-container\n *ngIf=\"!state.options.hideResizeSquares && !(state.options.cropperStaticWidth && state.options.cropperStaticHeight)\">\n <span\n class=\"ngx-ic-resize ngx-ic-topleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-topright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'topright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'topright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomright\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomright')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottomleft\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottomleft')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-top\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n ></span>\n\n <span\n class=\"ngx-ic-resize ngx-ic-top\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'top')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'top')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-right\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-right\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'right')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'right')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-bottom\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-bottom\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'bottom')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n <span\n class=\"ngx-ic-resize-bar ngx-ic-left\"\n role=\"presentation\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n ></span>\n <span\n class=\"ngx-ic-resize ngx-ic-left\"\n (mousedown)=\"startMove($event, moveTypes.Resize, 'left')\"\n (touchstart)=\"startMove($event, moveTypes.Resize, 'left')\"\n >\n <span class=\"ngx-ic-square\"></span>\n </span>\n </ng-container>\n </div>\n</div>\n", styles: [":host{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}:host>div{width:100%;position:relative}:host>div img.ngx-ic-source-image{display:inline;max-width:100%;max-height:100%;transform-origin:center}:host>div img.ngx-ic-source-image.ngx-ic-draggable{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}:host .ngx-ic-overlay{position:absolute;pointer-events:none;touch-action:none;outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}:host .ngx-ic-cropper{position:absolute;display:flex;color:var(--cropper-color, #53535C);background:transparent;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){:host .ngx-ic-cropper{outline-width:100vh}}:host .ngx-ic-cropper:after{position:absolute;content:\"\";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}:host .ngx-ic-cropper .ngx-ic-move{width:100%;cursor:move;border:var(--cropper-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper:hover .ngx-ic-move{border:var(--cropper-hover-border, var(--cropper-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper:focus .ngx-ic-move{border:var(--cropper-focus-border, 2px solid dodgerblue)}:host .ngx-ic-cropper:focus .ngx-ic-resize .ngx-ic-square{background:var(--cropper-resize-square-focus-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-focus-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize .ngx-ic-square{display:inline-block;width:6px;height:6px;box-sizing:content-box;background:var(--cropper-resize-square-bg, #53535C);border:var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5))}:host .ngx-ic-cropper .ngx-ic-resize:hover .ngx-ic-square{background:var(--cropper-resize-square-hover-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-hover-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topleft{top:-12px;left:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-top{top:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-topright{top:-12px;right:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-right{top:calc(50% - 12px);right:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomright{bottom:-12px;right:-12px;cursor:nwse-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottom{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-bottomleft{bottom:-12px;left:-12px;cursor:nesw-resize}:host .ngx-ic-cropper .ngx-ic-resize.ngx-ic-left{top:calc(50% - 12px);left:-12px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar{position:absolute;z-index:1}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-top{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-right{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-bottom{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}:host .ngx-ic-cropper .ngx-ic-resize-bar.ngx-ic-left{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}:host .ngx-ic-cropper.ngx-ic-round{outline-color:transparent}:host .ngx-ic-cropper.ngx-ic-round:after{border-radius:100%;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){:host .ngx-ic-cropper.ngx-ic-round:after{box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}:host .ngx-ic-cropper.ngx-ic-round .ngx-ic-move{border-radius:100%}:host.disabled .ngx-ic-cropper .ngx-ic-resize,:host.disabled .ngx-ic-cropper .ngx-ic-resize-bar,:host.disabled .ngx-ic-cropper .ngx-ic-move{display:none}:host.ngx-ic-hidden{display:none}\n"] }]
|
|
1358
1365
|
}], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { wrapper: [{
|
|
1359
1366
|
type: ViewChild,
|
|
1360
1367
|
args: ['wrapper', { static: true }]
|