jquery 图片截取工具jquery.imagecropper.js

2020-05-17 06:27:22易采站长站整理

left: -this.settings.left + ‘px’,
top: -this.settings.top + ‘px’
});
this.settings.left = this.settings.cropFrameRect.left – parseInt($(‘.crop-background’, this.wrapper).css(‘left’));
this.settings.top = this.settings.cropFrameRect.top – parseInt($(‘.crop-background’, this.wrapper).css(‘top’));
this.zoom(this.img.width * this.settings.zoomLevel, this.img.height * this.settings.zoomLevel);
},
zoom: function(width, height) {
$(‘.crop-background, .background-img, .foreground-img’, this.wrapper).width(width).height(height);
//调整拖动限制框
$(‘.drag-containment’, this.wrapper).css({
left: this.settings.cropFrameRect.left + this.settings.width – this.settings.zoomLevel * this.img.width + 1 + ‘px’,
top: this.settings.cropFrameRect.top + this.settings.height – this.settings.zoomLevel * this.img.height + 1 + ‘px’,
width: 2 * this.settings.zoomLevel * this.img.width – this.settings.width + ‘px’,
height: 2 * this.settings.zoomLevel * this.img.height – this.settings.height + ‘px’
});
},
formatNumber: function(number, bit) {
return Math.round(number * Math.pow(10, bit)) / Math.pow(10, bit);
},
fireCallback: function(fn) {
if ($.isFunction(fn)) {
fn.call(this);
};
}
};
})(jQuery);