zhangwei
2024-08-14 9d8994790fe403935ed46ad478f83ae110bb7a01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
<template>
    <!--本文件由FirstUI授权予四川政采招投标咨询有限公司(会员ID: 16 3,营业执照号:9 1   5 1   0  131 332   0061 9 3 K)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
    <view class="fui-image__cropper" :style="{zIndex:zIndex,background:background}" @touchmove.stop.prevent="stop">
        <!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
        <image :data-app="isApp" @touchstart="handler.touchstart" @touchmove="handler.touchmove" @touchend="handler.touchend"
            @mousedown="handler.mousedown" class="fui-cropper__img"
            :class="{'fui-cropper__img-hidden':!src || !initVal}" :src="src"
            :style="{width: (imgWidth ? imgWidth : width) + 'px',height: imgHeight ? imgHeight + 'px' : 'auto',transitionDuration: ani ?'0.25s' : '0s'}"
            mode="widthFix">
        </image>
        <!-- #endif -->
        <!-- #ifdef APP-NVUE -->
        <image ref="fui_cropper_img" class="fui-cropper__img" :src="src"
            :style="{width: (imgWidth ? imgWidth : width) + 'px',height: imgHeight ? imgHeight + 'px' : 'auto'}"
            mode="widthFix">
        </image>
        <!-- #endif -->
        <!-- #ifndef APP-PLUS || MP-WEIXIN || H5 -->
        <image @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend" class="fui-cropper__img"
            :class="{'fui-cropper__img-hidden':!src || !initVal}" :src="src"
            :style="{width: (imgWidth ? imgWidth : width) + 'px',height: imgHeight ? imgHeight + 'px' : 'auto',transitionDuration: ani ?'0.25s' : '0s',transform:getTransform}"
            mode="widthFix">
        </image>
        <!-- #endif -->
 
        <!-- #ifdef APP-NVUE -->
        <view class="fui-cropper__mask">
            <view class="fui-cropper__top" :style="{height:(windowHeight-canvasHeight)/2+'px'}"></view>
            <view class="fui-cropper__left" :style="{width:(windowWidth-canvasWidth)/2+'px',height:height+'px'}"></view>
            <view class="fui-cropper__right" :style="{width:(windowWidth-canvasWidth)/2+'px',height:height+'px'}">
            </view>
            <view class="fui-cropper__bottom" :style="{height:(windowHeight-canvasHeight)/2+'px'}"></view>
            <view class="fui-cropper__border"
                :style="{width:width+'px',height:height+'px', borderRadius: round ? canvasWidth/2+'px' : '0',borderColor:borderColor}">
            </view>
            <view class="fui-cropper__real-el"
                :style="{width: (imgWidth ? imgWidth : width) + 'px',height: imgHeight ? imgHeight + 'px' : 'auto'}"
                @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend" ref="fui_cropper_real"></view>
        </view>
        <!-- #endif -->
 
        <!-- #ifndef APP-NVUE -->
        <view class="fui-cropper__mask"
            :style="{ width: width + 'px', height: height + 'px', borderRadius: round ? '50%' : '0' }">
            <!-- #ifdef APP-VUE || MP-WEIXIN || H5-->
            <view class="fui-cropper__border" :change:prop="handler.valsChange" :prop="changeval" :data-width="width"
                :data-height="height" :data-windowheight="windowHeight" :data-windowwidth="windowWidth"
                :data-imgwidth="imgWidth" :data-imgheight="imgHeight" :data-imgtop="imgTop" :data-imgLeft="imgLeft"
                :data-angle="angle" :style="{ borderRadius: round ? '50%' : '0',borderColor:borderColor}"></view>
            <!-- #endif -->
            <!-- #ifndef APP-PLUS || MP-WEIXIN || H5 -->
            <view class="fui-cropper__border" :style="{ borderRadius: round ? '50%' : '0',borderColor:borderColor}">
            </view>
            <!-- #endif -->
        </view>
        <!-- #endif -->
 
        <!-- #ifndef APP-NVUE -->
        <canvas canvas-id="fui_image_cropper" id="fui_image_cropper" :disable-scroll="true"
            :style="{ width: nWidth * nScaleRatio + 'px', height:  nHeight * nScaleRatio + 'px' }"
            class="fui-cropper__canvas"></canvas>
        <!-- #endif -->
    </view>
</template>
 
<!-- #ifdef APP-VUE || MP-WEIXIN || H5-->
<script src="./index.wxs" module="handler" lang="wxs"></script>
<!-- #endif -->
 
<script>
    import mpjs from './mpjs.js'
    import bindingx from './bindingx.js'
    export default {
        name: "fui-image-cropper",
        mixins: [mpjs, bindingx],
        props: {
            src: {
                type: String,
                default: ''
            },
            //裁剪框高度 px
            height: {
                type: [Number, String],
                default: 280
            },
            //裁剪框宽度 px
            width: {
                type: [Number, String],
                default: 280
            },
            //是否为圆形裁剪框
            round: {
                type: Boolean,
                default: false
            },
            borderColor: {
                type: String,
                default: '#B2B2B2'
            },
            // #ifndef MP-QQ
            scaleRatio: {
                type: [Number, String],
                default: 2
            },
            // #endif
            // #ifdef MP-QQ
            scaleRatio: {
                type: [Number, String],
                default: 3
            },
            // #endif
            //图片的质量,取值范围为 (0, 1],不在范围内时当作1.0处理
            quality: {
                type: Number,
                default: 0.8
            },
            fileType: {
                type: String,
                default: 'png'
            },
            //是否为网络图片
            network: {
                type: Boolean,
                default: false
            },
            background: {
                type: String,
                default: 'rgba(0,0,0,.6)'
            },
            zIndex: {
                type: [Number, String],
                default: 10
            },
            isNav: {
                type: Boolean,
                default: false
            }
        },
        watch: {
            src(val) {
                this.initVal && this.handleImage(val)
            },
            ani(val) {
                clearTimeout(this.aniTimer);
                if (val) {
                    this.aniTimer = setTimeout(() => {
                        this.ani = false;
                    }, 220);
                }
            },
            scaleRatio(val) {
                this.nScaleRatio = Number(val) || 2
            },
            width(val) {
                this.nWidth = Number(val) || 280
                this.changeReset()
            },
            height(val) {
                this.nHeight = Number(val) || 280
                this.changeReset()
            }
        },
        data() {
            let isApp = 0;
            // #ifdef APP
            isApp = 1;
            // #endif
            return {
                isApp,
                windowHeight: 600,
                windowWidth: 400,
                cutX: 0,
                cutY: 0,
                imgWidth: 0,
                imgHeight: 0,
                scale: 1,
                angle: 0,
                ani: false,
                imgTop: 0,
                imgLeft: 0,
                changeval: '',
                initVal: false,
                naturalWidth: 0,
                naturalHeight: 0,
                picturePath: '',
                rotateAngle: 0,
                nScaleRatio: 2,
                nWidth: 280,
                nHeight: 280
            };
        },
        created() {
            this.cutTimer = null;
            this.aniTimer = null;
            this.ctx = null;
            this.nScaleRatio = Number(this.scaleRatio) || 2
            this.nWidth = Number(this.width) || 280
            this.nHeight = Number(this.height) || 280
        },
        mounted() {
            let sys = uni.getSystemInfoSync();
            let windowHeight = sys.windowHeight;
            this.windowWidth = sys.windowWidth
            // #ifdef H5
            if (this.isNav) {
                //使用了自带导航栏
                windowHeight += 44;
            }
            // #endif
            this.windowHeight = windowHeight;
            this.imgTop = windowHeight / 2;
            this.imgLeft = sys.windowWidth / 2;
            this.$nextTick(() => {
                // #ifndef APP-NVUE
                this.ctx = uni.createCanvasContext('fui_image_cropper', this);
                // #endif
                setTimeout(() => {
                    this.changeval = `1_${this.getRandom()}`;
                    this.initVal = true
                    setTimeout(() => {
                        this.src && this.handleImage(this.src)
                    }, 50);
                }, 220);
            })
        },
        methods: {
            stop() {},
            getRandom() {
                return Math.ceil(Math.random() * 10e5).toString(36)
            },
            loading() {
                uni.showLoading({
                    // #ifndef MP-ALIPAY
                    mask: true,
                    // #endif
                    title: '请稍候...'
                });
            },
            reset() {
                this.scale = 1;
                this.angle = 0;
                let sys = uni.getSystemInfoSync();
                let windowHeight = sys.windowHeight;
                // #ifdef H5
                if (this.isNav) {
                    windowHeight += 44;
                }
                // #endif
                this.imgTop = windowHeight / 2;
                this.imgLeft = sys.windowWidth / 2;
                this.changeval = `4_${this.getRandom()}`;
            },
            changeReset() {
                this.reset()
                this.$nextTick(() => {
                    setTimeout(() => {
                        this.changeval = `1_${this.getRandom()}`;
                        setTimeout(() => {
                            this.src && this.handleImage(this.src)
                        }, 50);
                    }, 50);
                })
            },
            calcSize(width, height) {
                let imgWidth = width,
                    imgHeight = height;
                if (imgWidth > 0 && imgHeight > 0) {
                    if (imgWidth / imgHeight > this.nWidth / this.nHeight) {
                        imgHeight = this.nHeight;
                        imgWidth = (width / height) * imgHeight;
                    } else {
                        imgWidth = this.nWidth;
                        imgHeight = (height / width) * imgWidth;
                    }
                } else {
                    imgWidth = uni.getSystemInfoSync().windowWidth;
                    imgHeight = 0;
                }
                this.imgWidth = imgWidth;
                this.imgHeight = imgHeight;
                this.changeval = `2_${this.getRandom()}`;
                uni.hideLoading()
            },
            // #ifdef APP-NVUE
            async compressImage(url, width, height, orientation) {
                let imgUrl = url;
                if (this.network) {
                    imgUrl = await this.getLocalImage(url);
                    if (!imgUrl) {
                        this.toast('网络图片处理失败~');
                        return;
                    }
                }
                let defaultAngle = {
                    up: 0,
                    down: 180,
                    left: 270,
                    right: 90
                } [orientation] || 0;
                let f_dst = `_documents/${this.getRandom()}.jpg`;
                plus.zip.compressImage({
                        src: imgUrl,
                        dst: f_dst,
                        overwrite: true,
                        rotate: defaultAngle,
                        format: 'jpg'
                    },
                    i => {
                        this.picturePath = i.target;
                        this.calcSize(width, height);
                        this.changeval = `3_${this.getRandom()}`;
                    },
                    e => {
                        this.picturePath = imgUrl;
                        this.calcSize(width, height);
                        this.changeval = `3_${this.getRandom()}`;
                    }
                );
            },
            // #endif
            handleImage(src) {
                this.reset();
                this.loading();
                uni.getImageInfo({
                    src: src,
                    success: res => {
                        let width = res.width;
                        let height = res.height;
                        this.naturalWidth = width;
                        this.naturalHeight = height;
                        let orientation = res.orientation;
                        if (orientation && orientation != 'up') {
                            //此处需要测试,可能导致裁剪出错
                            // #ifdef APP-NVUE
                            //宽高传值颠倒
                            width = orientation == 'down' ? res.width : res.height;
                            height = orientation == 'down' ? res.height : res.width;
                            this.compressImage(src, width, height, orientation);
                            // #endif
                        } else {
                            // #ifdef APP-NVUE
                            this.calcSize(width, height);
                            this.changeval = `3_${this.getRandom()}`;
                            // #endif
                        }
 
                        // #ifndef APP-NVUE
                        this.calcSize(width, height);
                        this.changeval = `3_${this.getRandom()}`;
                        // #endif
                    },
                    fail: err => {
                        this.calcSize(0, 0);
                        this.changeval = `3_${this.getRandom()}`;
                    }
                });
            },
            change(e) {
                this.cutX = e.cutX || 0;
                this.cutY = e.cutY || 0;
                this.imgWidth = e.imgWidth || this.imgWidth;
                this.imgHeight = e.imgHeight || this.imgHeight;
                this.scale = e.scale || 1;
                this.angle = e.angle || 0;
                this.imgTop = e.imgTop || 0;
                this.imgLeft = e.imgLeft || 0;
            },
            async getLocalImage(src) {
                return await new Promise((resolve, reject) => {
                    uni.downloadFile({
                        url: src,
                        success: res => {
                            resolve(res.tempFilePath);
                        },
                        fail: res => {
                            reject(false);
                        }
                    });
                });
            },
            moveStop() {
                clearTimeout(this.cutTimer);
                this.cutTimer = setTimeout(() => {
                    this.changeval = `5_${this.getRandom()}`;
                }, 600);
            },
            moveDuring() {
                clearTimeout(this.cutTimer);
            },
            rotate() {
                if (!this.src) {
                    this.toast('请选择要裁剪的图片!')
                    return;
                }
                this.ani = true;
                let angle = this.angle + 90;
                if (angle % 90) {
                    angle = Math.round(angle / 90) * 90;
                }
                this.angle = angle
                this.moveStop();
                this.changeval = `3_${this.getRandom()}`;
            },
            toast(text) {
                uni.showToast({
                    title: text,
                    icon: 'none'
                });
            },
            // #ifdef APP-NVUE
            getImageByNvue(callback) {
                let getCutImg = async () => {
                    let imgUrl = this.picturePath || this.src;
                    if (this.network) {
                        imgUrl = await this.getLocalImage(this.src);
                        if (!imgUrl) {
                            this.toast('网络图片处理失败~');
                            return;
                        }
                    }
                    let f_dst = `_documents/${this.getRandom()}.${this.fileType}`;
                    let multiple = Math.round(this.angle / 90);
                    let angle = 0,
                        x = 0,
                        y = 0,
                        left = 0,
                        top = 0,
                        clipHeight = 0,
                        clipWidth = 0;
                    let sys = uni.getSystemInfoSync();
                    let isAndroid = sys.platform.toLocaleLowerCase() == 'android';
 
                    if (multiple % 2 == 0) {
                        angle = this.angle % 360 == 0 || this.angle == 0 ? 0 : 180;
                        if (!isAndroid || (isAndroid && angle == 0)) {
                            x = this.imgLeft - (this.imgWidth * this.scale) / 2;
                            y = this.imgTop - (this.imgHeight * this.scale) / 2;
                            left = (((this.cutX - x) / this.imgWidth / this.scale) * 100).toFixed(2);
                            top = (((this.cutY - y) / this.imgHeight / this.scale) * 100).toFixed(2);
                            clipWidth = ((this.canvasWidth / this.imgWidth / this.scale) * 100).toFixed(2);
                            clipHeight = ((this.canvasHeight / this.imgHeight / this.scale) * 100).toFixed(2);
                        } else {
                            x = this.imgLeft - (this.imgWidth * this.scale) / 2;
                            y = this.imgTop - (this.imgHeight * this.scale) / 2;
                            left = (((this.imgWidth * this.scale - (this.cutX - x) - this.canvasWidth) / this
                                .imgWidth / this.scale) * 100).toFixed(2);
                            top = (((this.imgHeight * this.scale - (this.cutY - y) - this.canvasHeight) / this
                                .imgHeight / this.scale) * 100).toFixed(2);
                            clipWidth = ((this.canvasWidth / this.imgWidth / this.scale) * 100).toFixed(2);
                            clipHeight = ((this.canvasHeight / this.imgHeight / this.scale) * 100).toFixed(2);
                        }
                    } else {
                        angle = this.angle % 270 == 0 ? 270 : 90;
                        if (isAndroid) {
                            if (angle == 90) {
                                x = this.imgLeft - (this.imgHeight * this.scale) / 2;
                                y = this.imgTop - (this.imgWidth * this.scale) / 2;
                                top = (((this.imgHeight * this.scale - (this.cutX - x) - this.canvasHeight) / this
                                    .imgHeight / this.scale) * 100).toFixed(2);
                                left = (((this.imgWidth * this.scale - (this.cutY - y) - this.canvasWidth) / this
                                    .imgWidth / this.scale) * 100).toFixed(2);
                                clipHeight = ((this.canvasWidth / this.imgHeight / this.scale) * 100).toFixed(2);
                                clipWidth = ((this.canvasHeight / this.imgWidth / this.scale) * 100).toFixed(2);
                            } else {
                                x = this.imgLeft - (this.imgHeight * this.scale) / 2;
                                y = this.imgTop - (this.imgWidth * this.scale) / 2;
                                top = (((this.cutX - x) / this.imgHeight / this.scale) * 100).toFixed(2);
                                left = (((this.cutY - y) / this.imgWidth / this.scale) * 100).toFixed(2);
                                clipHeight = ((this.canvasWidth / this.imgHeight / this.scale) * 100).toFixed(2);
                                clipWidth = ((this.canvasHeight / this.imgWidth / this.scale) * 100).toFixed(2);
                            }
                        } else {
                            x = this.imgLeft - (this.imgHeight * this.scale) / 2;
                            y = this.imgTop - (this.imgWidth * this.scale) / 2;
                            left = (((this.cutX - x) / this.imgHeight / this.scale) * 100).toFixed(2);
                            top = (((this.cutY - y) / this.imgWidth / this.scale) * 100).toFixed(2);
                            clipWidth = ((this.canvasWidth / this.imgHeight / this.scale) * 100).toFixed(2);
                            clipHeight = ((this.canvasHeight / this.imgWidth / this.scale) * 100).toFixed(2);
                        }
                    }
                    let width = (this.imgWidth < this.naturalWidth ? this.naturalWidth : this.imgWidth) * this
                        .scale;
                    let height = (this.imgHeight < this.naturalHeight ? this.naturalHeight : this.imgHeight) * this
                        .scale;
                    width = `${width}px`;
                    height = `${height}px`;
                    left = Number(left) <= 0 ? 0 : left;
                    top = Number(top) <= 0 ? 0 : top;
                    plus.zip.compressImage({
                            src: imgUrl,
                            dst: f_dst,
                            quality: this.quality * 100,
                            overwrite: true,
                            format: this.fileType,
                            width: width,
                            height: height,
                            rotate: angle,
                            clip: {
                                top: `${top}%`,
                                left: `${left}%`,
                                width: `${clipWidth}%`,
                                height: `${clipHeight}%`
                            }
                        },
                        i => {
                            uni.hideLoading();
                            callback && callback(i.target)
                        },
                        e => {
                            console.log(e);
                            uni.hideLoading();
                            this.toast('图片裁剪失败,请稍候再试~');
                        }
                    );
                };
                setTimeout(() => {
                    getCutImg();
                }, 20);
            },
            // #endif
            //裁剪
            cutting(callback) {
                if (!this.src) {
                    this.toast('请选择要裁剪的图片!')
                    return;
                }
                this.loading();
                // #ifdef APP-NVUE
                this.getImageByNvue(callback)
                // #endif
 
                // #ifndef APP-NVUE
                let draw = async () => {
                    let imgWidth = this.imgWidth * this.scale * this.nScaleRatio;
                    let imgHeight = this.imgHeight * this.scale * this.nScaleRatio;
                    let xpos = this.imgLeft - this.cutX;
                    let ypos = this.imgTop - this.cutY;
                    this.ctx.translate(xpos * this.nScaleRatio, ypos * this.nScaleRatio);
                    this.ctx.rotate((this.angle * Math.PI) / 180);
                    let src = this.src;
                    // #ifdef APP-PLUS || MP
                    if (this.network) {
                        src = await this.getLocalImage(this.src);
                    }
                    // #endif
                    this.ctx.drawImage(src, -imgWidth / 2, -imgHeight / 2, imgWidth, imgHeight);
                    this.ctx.draw(false, () => {
                        let params = {
                            width: this.nWidth * this.nScaleRatio,
                            height: Math.round(this.nHeight * this.nScaleRatio),
                            // #ifdef MP-QQ
                            destWidth: this.nWidth * this.nScaleRatio * 2,
                            destHeight: Math.round(this.nHeight) * this.nScaleRatio * 2,
                            // #endif
 
                            // #ifndef MP-QQ
                            destWidth: this.nWidth * this.nScaleRatio,
                            destHeight: Math.round(this.nHeight) * this.nScaleRatio,
                            // #endif
                            fileType: this.fileType,
                            quality: this.quality
                        };
                        setTimeout(() => {
                            // #ifdef MP-ALIPAY
                            this.ctx.toTempFilePath({
                                ...params,
                                success: res => {
                                    uni.hideLoading();
                                    this.ctx.rotate(((360 - this.angle % 360) * Math
                                        .PI) / 180);
                                    this.ctx.translate(-xpos * this.nScaleRatio, -
                                        ypos * this.nScaleRatio);
                                    this.ctx.clearRect(0, 0, this.nWidth * this
                                        .nScaleRatio, this.nHeight * this
                                        .nScaleRatio);
                                    this.ctx.draw();
                                    callback && callback(res.apFilePath)
                                }
                            });
                            // #endif
 
                            // #ifndef MP-ALIPAY
                            uni.canvasToTempFilePath({
                                    ...params,
                                    canvasId: 'fui_image_cropper',
                                    success: res => {
                                        uni.hideLoading();
                                        callback && callback(res.tempFilePath)
                                    },
                                    fail(err) {
                                        console.log(err);
                                    }
                                },
                                this
                            );
                            // #endif
                        }, 80)
                    });
                };
                draw();
                // #endif
            }
        }
    }
</script>
 
<style scoped>
    .fui-image__cropper {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        z-index: 1;
    }
 
    .fui-cropper__img,
    .fui-cropper__real-el {
        /* #ifndef APP-NVUE */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        /* #endif */
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        transform-origin: center;
    }
 
    /* #ifndef APP-NVUE */
    .fui-cropper__img-hidden {
        opacity: 0;
        visibility: hidden;
    }
 
    /* #endif */
    .fui-cropper__mask {
        position: fixed;
        z-index: 4;
        /* #ifndef APP-NVUE */
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        border: 3000px solid rgba(0, 0, 0, 0.5);
        pointer-events: none;
        /* #endif */
 
        /* #ifdef APP-NVUE */
        border-style: solid;
        border-color: rgba(0, 0, 0, 0.5);
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        align-items: center;
        justify-content: center;
        /* #endif */
    }
 
    .fui-cropper__border {
        /* #ifndef APP-NVUE */
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        box-sizing: border-box;
        pointer-events: none;
        /* #endif */
        border-width: 1px;
        border-style: solid;
    }
 
    /* #ifndef APP-NVUE */
    .fui-cropper__canvas {
        position: fixed;
        left: -3000px;
        top: -3000px;
        pointer-events: none;
    }
 
    /* #endif */
 
    /* #ifdef APP-NVUE */
    .fui-cropper__top {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        background: rgba(0, 0, 0, 0.5);
    }
 
    .fui-cropper__left {
        position: absolute;
        left: 0;
        background: rgba(0, 0, 0, 0.5);
    }
 
    .fui-cropper__right {
        position: absolute;
        right: 0;
        background: rgba(0, 0, 0, 0.5);
    }
 
    .fui-cropper__bottom {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
    }
 
    /* #endif */
</style>