Commit 5de623f2 authored by Romain Courteaud's avatar Romain Courteaud

erp5_document_scanner: patch cropperjs

Always render cropper when resizing
parent 198e782c
...@@ -1793,38 +1793,9 @@ ...@@ -1793,38 +1793,9 @@
var handlers = { var handlers = {
resize: function resize() { resize: function resize() {
var options = this.options, // Always render fully
container = this.container, // Otherwise, there are some display issue when increasing the window size (part of the canvas is hidden)
containerData = this.containerData;
var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;
var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;
if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
return;
}
var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed
if (ratio !== 1 || container.offsetHeight !== containerData.height) {
var canvasData;
var cropBoxData;
if (options.restore) {
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
}
this.render(); this.render();
if (options.restore) {
this.setCanvasData(forEach(canvasData, function (n, i) {
canvasData[i] = n * ratio;
}));
this.setCropBoxData(forEach(cropBoxData, function (n, i) {
cropBoxData[i] = n * ratio;
}));
}
}
}, },
dblclick: function dblclick() { dblclick: function dblclick() {
if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) { if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment