Roo/dialog/UploadCropbox.js
[roojs1] / Roo / dialog / UploadCropbox.js
index 4e7c0d1..8279efb 100644 (file)
@@ -558,8 +558,11 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         e.stopEvent();
         
         this.startScale = this.scale;
-        this.scale = (e.getWheelDelta() == 1) ? (this.scale + 1) : (this.scale - 1);
+        this.scale = (e.getWheelDelta() > 0) ? (this.scale + 1) : (this.scale - 1);
         
+        console.log('startScale: ' + this.startScale);
+        console.log('scale: ' + this.scale);
+        console.log('getWheelDelta: ' + e.getWheelDelta());
         if(!this.zoomable()){
             this.scale = this.startScale;
             return;
@@ -1053,11 +1056,11 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
             }
         }
         
-        height = 300;
+        height = 500;
         width = Math.ceil(this.minWidth * height / this.minHeight);
         
         if(this.minWidth > this.minHeight){
-            width = 300;
+            width = 500;
             height = Math.ceil(this.minHeight * width / this.minWidth);
         }
         
@@ -1306,11 +1309,8 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         
         var formData = new FormData();
 
-        formData.append("onid", "43024");
-        formData.append("ontable", "pressrelease_boilerplate");
-
         formData.append('returnHTML', 'NO');
-        
+
         if(crop){
             formData.append('crop', crop);
             var blobBin = atob(crop.split(',')[1]);
@@ -1318,7 +1318,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
             for(var i = 0; i < blobBin.length; i++) {
                 array.push(blobBin.charCodeAt(i));
             }
-            var croppedFile =new Blob([new Uint8Array(array)], {type: 'image/png'});
+            var croppedFile =new Blob([new Uint8Array(array)], {type: this.cropType});
             formData.append(this.paramName, croppedFile, file.name);
         }
         
@@ -1392,7 +1392,9 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         }
         
         this.file = file;
-        this.cropType = file.type;
+        if(typeof(file.type) != 'undefined' && file.type.length != 0) {
+            this.cropType = file.type;
+        }
         
         var _this = this;