roojs-bootstrap.js
authoredward <edward@roojs.com>
Fri, 19 Feb 2016 06:26:42 +0000 (14:26 +0800)
committeredward <edward@roojs.com>
Fri, 19 Feb 2016 06:26:42 +0000 (14:26 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 8856380..ee399f2 100644 (file)
@@ -24014,7 +24014,13 @@ Roo.bootstrap.UploadCropbox = function(config){
          * @param {Roo.bootstrap.UploadCropbox} this
          * @param {String} type
          */
-        "footerbuttonclick" : true
+        "footerbuttonclick" : true,
+        /**
+         * @event resize
+         * Fire when resize
+         * @param {Roo.bootstrap.UploadCropbox} this
+         */
+        "resize" : true
         
     });
     
@@ -24169,8 +24175,10 @@ Roo.extend(Roo.bootstrap.UploadCropbox, Roo.bootstrap.Component,  {
     
     resize : function()
     {
-        this.setThumbBoxPosition();
-        this.setCanvasPosition();
+        if(this.fireEvent('resize', this) != false){
+            this.setThumbBoxPosition();
+            this.setCanvasPosition();
+        }
     },
     
     onFooterButtonClick : function(e, el, o, type)
index 013988f..86d858e 100644 (file)
@@ -980,7 +980,7 @@ if(this.faicon){A.cn[0].cls+=' fa '+this.faicon;}if(this.weight){A.cls+=' alert-
 },setIcon:function(A){if(this.faicon){this.el.select('.roo-alert-icon',true).first().removeClass(['fa','fa-'+this.faicon]);}this.faicon=Athis.el.select('.roo-alert-icon',true).first().addClass(['fa','fa-'+this.faicon]);},hide:function(){this.el.hide();},show:function(){this.el.show();
 }});
 // Roo/bootstrap/UploadCropbox.js
-Roo.bootstrap.UploadCropbox=function(A){Roo.bootstrap.UploadCropbox.superclass.constructor.call(this,A);this.addEvents({"beforeselectfile":true,"initial":true,"crop":true,"prepare":true,"exception":true,"beforeloadcanvas":true,"trash":true,"download":true,"footerbuttonclick":true});
+Roo.bootstrap.UploadCropbox=function(A){Roo.bootstrap.UploadCropbox.superclass.constructor.call(this,A);this.addEvents({"beforeselectfile":true,"initial":true,"crop":true,"prepare":true,"exception":true,"beforeloadcanvas":true,"trash":true,"download":true,"footerbuttonclick":true,"resize":true});
 this.buttons=this.buttons||Roo.bootstrap.UploadCropbox.footer.STANDARD;};Roo.extend(Roo.bootstrap.UploadCropbox,Roo.bootstrap.Component,{emptyText:'Click to upload image',scale:0,baseScale:1,rotate:0,dragable:false,pinching:false,mouseX:0,mouseY:0,cropData:false,minWidth:300,minHeight:300,file:false,exif:{},baseRotate:1,cropType:'image/jpeg',buttons:false,getAutoCreate:function(){var A={tag:'div',cls:'roo-upload-cropbox',cn:[{tag:'div',cls:'roo-upload-cropbox-body',cn:[{tag:'div',cls:'roo-upload-cropbox-preview'},{tag:'div',cls:'roo-upload-cropbox-thumb'},{tag:'div',cls:'roo-upload-cropbox-empty-notify',html:this.emptyText}]},{tag:'div',cls:'roo-upload-cropbox-footer',cn:{tag:'div',cls:'btn-group btn-group-justified roo-upload-cropbox-btn-group',cn:[]}}]};
 return A;},onRender:function(ct,A){Roo.bootstrap.UploadCropbox.superclass.onRender.call(this,ct,A);if(this.buttons.length){Roo.each(this.buttons,function(bb){var B=this.el.select('.roo-upload-cropbox-footer div.roo-upload-cropbox-btn-group').first().createChild(bb);
 B.on('click',this.onFooterButtonClick.createDelegate(this,[bb.action],true));},this);}},initEvents:function(){this.urlAPI=(window.createObjectURL&&window)||(window.URL&&URL.revokeObjectURL&&URL)||(window.webkitURL&&webkitURL);this.bodyEl=this.el.select('.roo-upload-cropbox-body',true).first();
@@ -989,8 +989,8 @@ this.thumbEl=this.el.select('.roo-upload-cropbox-thumb',true).first();this.thumb
 this.footerEl=this.el.select('.roo-upload-cropbox-footer',true).first();this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.footerEl.hide();this.setThumbBoxSize();this.bind();this.fireEvent('initial',this);},bind:function(){var A=this;
 window.addEventListener("resize",function(){A.resize();});if(!this.bodyHasOnClickEvent){this.bodyEl.on('click',this.beforeSelectFile,this);this.bodyHasOnClickEvent=true;}if(Roo.isTouch){this.bodyEl.on('touchstart',this.onTouchStart,this);this.bodyEl.on('touchmove',this.onTouchMove,this);
 this.bodyEl.on('touchend',this.onTouchEnd,this);}if(!Roo.isTouch){this.bodyEl.on('mousedown',this.onMouseDown,this);this.bodyEl.on('mousemove',this.onMouseMove,this);var B=(/Firefox/i.test(navigator.userAgent))?'DOMMouseScroll':'mousewheel';this.bodyEl.on(B,this.onMouseWheel,this);
-Roo.get(document).on('mouseup',this.onMouseUp,this);}},reset:function(){this.scale=0;this.baseScale=1;this.rotate=0;this.baseRotate=1;this.dragable=false;this.pinching=false;this.mouseX=0;this.mouseY=0;this.cropData=false;},resize:function(){this.setThumbBoxPosition();
-this.setCanvasPosition();},onFooterButtonClick:function(e,el,o,A){switch(A){case 'rotate-left':this.onRotateLeft(e);break;case 'rotate-right':this.onRotateRight(e);break;case 'picture':this.beforeSelectFile(e);break;case 'trash':this.trash(e);break;case 'crop':this.crop(e);
+Roo.get(document).on('mouseup',this.onMouseUp,this);}},reset:function(){this.scale=0;this.baseScale=1;this.rotate=0;this.baseRotate=1;this.dragable=false;this.pinching=false;this.mouseX=0;this.mouseY=0;this.cropData=false;},resize:function(){if(this.fireEvent('resize',this)!=false){this.setThumbBoxPosition();
+this.setCanvasPosition();}},onFooterButtonClick:function(e,el,o,A){switch(A){case 'rotate-left':this.onRotateLeft(e);break;case 'rotate-right':this.onRotateRight(e);break;case 'picture':this.beforeSelectFile(e);break;case 'trash':this.trash(e);break;case 'crop':this.crop(e);
 break;case 'download':this.download(e);break;default:break;}this.fireEvent('footerbuttonclick',this,A);},beforeSelectFile:function(e){if(e){e.preventDefault();}this.fireEvent('beforeselectfile',this);},trash:function(e){if(e){e.preventDefault();}this.fireEvent('trash',this);
 },download:function(e){if(e){e.preventDefault();}this.fireEvent('download',this);},loadCanvas:function(A){if(this.fireEvent('beforeloadcanvas',this,A)!=false){this.reset();this.imageEl=document.createElement('img');var B=this;this.imageEl.addEventListener("load",function(){B.onLoadCanvas();
 });this.imageEl.src=A;}},onLoadCanvas:function(){if(this.bodyHasOnClickEvent){this.bodyEl.un('click',this.beforeSelectFile,this);this.bodyHasOnClickEvent=false;}this.notifyEl.hide();this.thumbEl.show();this.footerEl.show();this.imageEl.OriginWidth=this.imageEl.naturalWidth||this.imageEl.width;