Roo/dialog/UploadCropbox.js
[roojs1] / Roo / dialog / UploadCropbox.js
index aefd96a..fc66c7a 100644 (file)
@@ -13,7 +13,7 @@
  * @cfg {Number} minWidth default 300
  * @cfg {Number} minHeight default 300
  * @cfg {Number} outputMaxWidth default 1200
- * @cfg {Number} windowWidth default 300
+ * @cfg {Number} windowSize default 300
  * @cfg {Array} buttons default ['rotateLeft', 'pictureBtn', 'rotateRight']
  * @cfg {Boolean} isDocument (true|false) default false
  * @cfg {String} url action url
@@ -152,7 +152,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
     minWidth : 300,
     minHeight : 300,
     outputMaxWidth : 1200,
-    windowWidth : 300,
+    windowSize : 300,
     file : false,
     exif : {},
     baseRotate : 1,
@@ -561,6 +561,9 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         
         this.startScale = this.scale;
         this.scale = (e.getWheelDelta() > 0) ? (this.scale + 1) : (this.scale - 1);
+
+        console.log("START SCALE: " + this.startScale);
+        console.log("TEST SCALE: " + this.scale);
         
         if(!this.zoomable()){
             this.scale = this.startScale;
@@ -583,8 +586,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
         
         var width = Math.ceil(this.imageEl.OriginWidth * this.getScaleLevel() / minScale);
         var height = Math.ceil(this.imageEl.OriginHeight * this.getScaleLevel() / minScale);
-
-
         var maxWidth = this.imageEl.OriginWidth;
         var maxHeight = this.imageEl.OriginHeight;
         
@@ -616,8 +618,8 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
                 !this.isDocument &&
                 (this.rotate == 0 || this.rotate == 180) && 
                 (
-                    (this.imageEl.OriginWidth >= this.minWidth) && width < this.minWidth ||
-                    (this.imageEl.OriginHeight >= this.minHeight) && height < this.minHeight ||
+                    (this.imageEl.OriginWidth / this.imageEl.OriginHeight >= this.minWidth / this.minHeight) && width < this.minWidth ||
+                    (this.imageEl.OriginWidth / this.imageEl.OriginHeight <= this.minWidth / this.minHeight) && height < this.minHeight ||
                     width > maxWidth ||
                     height > maxHeight
                 )
@@ -1055,11 +1057,11 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component,  {
             }
         }
         
-        height = 500;
+        height = this.windowSize;
         width = Math.ceil(this.minWidth * height / this.minHeight);
         
         if(this.minWidth > this.minHeight){
-            width = 500;
+            width = this.windowSize;
             height = Math.ceil(this.minHeight * width / this.minWidth);
         }