Commit ac73ad24 authored by Romain Courteaud's avatar Romain Courteaud

erp5_document_scanner: restore cropbox data when resizing

parent 311324aa
...@@ -1795,7 +1795,29 @@ ...@@ -1795,7 +1795,29 @@
resize: function resize() { resize: function resize() {
// Always render fully // Always render fully
// Otherwise, there are some display issue when increasing the window size (part of the canvas is hidden) // Otherwise, there are some display issue when increasing the window size (part of the canvas is hidden)
var options = this.options,
container = this.container,
containerData = this.containerData;
var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;
var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;
var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed
var canvasData;
var cropBoxData;
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
this.render(); this.render();
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