ngx-image-cropper 9.1.0 → 9.1.2
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 +18 -17
- package/esm2022/lib/component/image-cropper.component.mjs +7 -7
- package/esm2022/lib/services/crop.service.mjs +2 -2
- package/esm2022/lib/utils/cropper-position.utils.mjs +29 -29
- package/fesm2022/ngx-image-cropper.mjs +52 -51
- package/fesm2022/ngx-image-cropper.mjs.map +1 -1
- package/lib/component/cropper.state.d.ts +1 -1
- 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',
|
|
@@ -305,7 +306,7 @@ class CropperState {
|
|
|
305
306
|
return;
|
|
306
307
|
}
|
|
307
308
|
let positionPossiblyChanged = false;
|
|
308
|
-
if ((this.options.maintainAspectRatio && options['aspectRatio']) ||
|
|
309
|
+
if ((this.options.maintainAspectRatio && options['aspectRatio']) || 'maintainAspectRatio' in options) {
|
|
309
310
|
this.setCropperScaledMinSize();
|
|
310
311
|
this.setCropperScaledMaxSize();
|
|
311
312
|
if (this.options.maintainAspectRatio && (this.options.resetCropOnAspectRatioChange || !this.aspectRatioIsCorrect())) {
|
|
@@ -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,8 @@ 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
|
|
429
430
|
};
|
|
430
431
|
}
|
|
431
432
|
}
|
|
@@ -588,7 +589,7 @@ class CropService {
|
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
591
|
getRatio(cropperState) {
|
|
591
|
-
return cropperState.loadedImage.transformed.size.width / cropperState.maxSize.width;
|
|
592
|
+
return cropperState.loadedImage.transformed.size.width / cropperState.maxSize().width;
|
|
592
593
|
}
|
|
593
594
|
getImagePosition(cropperState) {
|
|
594
595
|
const ratio = this.getRatio(cropperState);
|
|
@@ -1061,7 +1062,7 @@ class ImageCropperComponent {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
reset() {
|
|
1063
1064
|
this.state.loadedImage = undefined;
|
|
1064
|
-
this.state.maxSize
|
|
1065
|
+
this.state.maxSize.set({ width: 0, height: 0 });
|
|
1065
1066
|
this.imageVisible = false;
|
|
1066
1067
|
}
|
|
1067
1068
|
loadImageFile(file) {
|
|
@@ -1119,7 +1120,7 @@ class ImageCropperComponent {
|
|
|
1119
1120
|
this.cropperChange.emit(this.state.cropper());
|
|
1120
1121
|
}
|
|
1121
1122
|
this.imageVisible = true;
|
|
1122
|
-
this.cropperReady.emit(
|
|
1123
|
+
this.cropperReady.emit(this.state.maxSize());
|
|
1123
1124
|
this.doAutoCrop();
|
|
1124
1125
|
}
|
|
1125
1126
|
else {
|
|
@@ -1138,7 +1139,7 @@ class ImageCropperComponent {
|
|
|
1138
1139
|
this.resizedWhileHidden = true;
|
|
1139
1140
|
}
|
|
1140
1141
|
else {
|
|
1141
|
-
const oldMaxSize =
|
|
1142
|
+
const oldMaxSize = this.state.maxSize();
|
|
1142
1143
|
this.setMaxSize();
|
|
1143
1144
|
this.state.resizeCropperPosition(oldMaxSize);
|
|
1144
1145
|
}
|
|
@@ -1297,7 +1298,7 @@ class ImageCropperComponent {
|
|
|
1297
1298
|
if (this.sourceImage) {
|
|
1298
1299
|
const sourceImageStyle = getComputedStyle(this.sourceImage.nativeElement);
|
|
1299
1300
|
this.state.setMaxSize(parseFloat(sourceImageStyle.width), parseFloat(sourceImageStyle.height));
|
|
1300
|
-
this.marginLeft = this.sanitizer.bypassSecurityTrustStyle('calc(50% - ' + this.state.maxSize.width / 2 + 'px)');
|
|
1301
|
+
this.marginLeft = this.sanitizer.bypassSecurityTrustStyle('calc(50% - ' + this.state.maxSize().width / 2 + 'px)');
|
|
1301
1302
|
}
|
|
1302
1303
|
}
|
|
1303
1304
|
emitCropperPositionChange(previousPosition) {
|
|
@@ -1350,11 +1351,11 @@ class ImageCropperComponent {
|
|
|
1350
1351
|
this.pinchStart$.complete();
|
|
1351
1352
|
}
|
|
1352
1353
|
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 }); }
|
|
1354
|
+
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
1355
|
}
|
|
1355
1356
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ImageCropperComponent, decorators: [{
|
|
1356
1357
|
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
|
|
1358
|
+
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
1359
|
}], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { wrapper: [{
|
|
1359
1360
|
type: ViewChild,
|
|
1360
1361
|
args: ['wrapper', { static: true }]
|