Vue-cropper 图片裁剪的基本原理及思路讲解

2020-06-13 10:37:58易采站长站整理

if (h > this.h) {
h = this.h
w = h / this.fixedNumber[1] * this.fixedNumber[0]}

自动截图的主要代码如下:


var w = this.autoCropWidth
var h = this.autoCropHeight
if (w === 0 || h === 0) {
w = this.w * 0.8
h = this.h * 0.8
}
w = w > this.w ? this.w : w
h = h > this.h ? this.h : h
if (this.fixed) {
h = w / this.fixedNumber[0] * this.fixedNumber[1]}
// 如果比例之后 高度大于h
if (h > this.h) {
h = this.h
w = h / this.fixedNumber[1] * this.fixedNumber[0]}

github的源码–PC端

总结

以上所述是小编给大家介绍的Vue-cropper 图片裁剪的基本原理及思路讲解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!