Roo/dialog/UploadCropbox.js
authorleon <leon@roojs.com>
Tue, 12 Jul 2022 03:05:52 +0000 (11:05 +0800)
committerleon <leon@roojs.com>
Tue, 12 Jul 2022 03:05:52 +0000 (11:05 +0800)
Roo/dialog/UploadCropbox.js

index 5776e90..12b2cd8 100644 (file)
@@ -873,6 +873,13 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         
         var context = canvas.getContext("2d");
 
+        canvas.width = this.thumbEl.getWidth() / this.getScaleLevel();
+        
+        canvas.height = this.thumbEl.getHeight() / this.getScaleLevel();
+
+        console.log("CANVAS WIDTH: " + canvas.width);
+        console.log("CANVAS HEIGHT: " + canvas.height);
+
         console.log("GETSCALELEVLE: " + this.getScaleLevel());
 
         switch (this.rotate) {
@@ -883,13 +890,6 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
 
                 console.log("WIDTH: " + width);
                 console.log("HEIGHT: " + height);
-
-                canvas.width = width;
-        
-                canvas.height = height;
-        
-                console.log("CANVAS WIDTH: " + canvas.width);
-                console.log("CANVAS HEIGHT: " + canvas.height);
                 
                 var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel());
                 var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel());