Roo/bootstrap/UploadCropbox.js
authoredward <edward@roojs.com>
Fri, 22 Jan 2016 09:09:16 +0000 (17:09 +0800)
committeredward <edward@roojs.com>
Fri, 22 Jan 2016 09:09:16 +0000 (17:09 +0800)
Roo/bootstrap/UploadCropbox.js

index 90663d8..d368348 100644 (file)
@@ -413,43 +413,19 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
     {
         e.stopEvent();
         
-        if(
-                (
-                    this.rotate == 0 || 
-                    this.rotate == 180
-                ) 
-                &&
-                (
-                    this.image.getHeight() < this.thumb.getWidth() ||
-                    this.image.getWidth() < this.thumb.getHeight()
-                )
-        ){
-            return;
-        }
-        
-        if(
-                (
-                    this.rotate == 90 || 
-                    this.rotate == 270
-                ) 
-                &&
-                (
-                    this.image.getWidth() < this.thumb.getWidth() ||
-                    this.image.getHeight() < this.thumb.getHeight()
-                )
-        ){
-            return;
+        if(this.canRotate()){
+            this.rotate = (this.rotate > 180) ? 0 : this.rotate + 90;
+        
+            this.imageCanvas.setStyle({
+                '-ms-transform' : 'rotate(' + this.rotate + 'deg)',
+                '-webkit-transform' : 'rotate(' + this.rotate + 'deg)',
+                'transform' : 'rotate(' + this.rotate + 'deg)'
+            });
+
+            this.setCanvasPosition();
         }
         
-        this.rotate = (this.rotate > 180) ? 0 : this.rotate + 90;
-        
-        this.imageCanvas.setStyle({
-            '-ms-transform' : 'rotate(' + this.rotate + 'deg)',
-            '-webkit-transform' : 'rotate(' + this.rotate + 'deg)',
-            'transform' : 'rotate(' + this.rotate + 'deg)'
-        });
         
-        this.setCanvasPosition();
     },
     
     crop : function()