【发布时间】:2020-11-01 22:51:33
【问题描述】:
我在我的项目中使用ngx-image-cropper 库。我只想以 16/9 的纵横比裁剪图像,这没关系。我已将aspectRatio 设置为 16/9,并且裁剪器是矩形的。我还实现了mat-slider,它应该只改变图像裁剪器的宽度和高度,就像它使用裁剪器的拖动箭头来缩放它一样。是否有可能将调整裁剪器大小的 mat-slider 事件添加到通过拖动箭头更改裁剪器比例时它是如何工作的?我不想用垫子滑块缩放图像,而只是裁剪器。我在ngx-image-cropper 库中进行了搜索,但没有找到适合我需要的任何内容。感谢您的帮助!
图书馆链接:https://www.npmjs.com/package/ngx-image-cropper
<div class="image-cropper-dimensions">
<image-crop
[imageFile]="data.file"
[cropWidth]="sliderValue"
[aspectRatio]="16 / 9"
[isFileStrip]="true"
[roundCropper]="data.isRoundedCropper"
(onImageCropped)="onImageCropped($event)"
>
</image-crop>
</div>
</div>
<div class="image-edit-container">
<mat-slider
[min]="SLIDER_MIN_VALUE"
[color]="'primary'"
[value]="sliderValue"
[step]="SLIDER_STEP"
(input)="onSliderChange($event)"
>
</mat-slider>
【问题讨论】: