From 1d900acf1713541fbe30eab7e46c473f4f995df8 Mon Sep 17 00:00:00 2001 From: leon Date: Tue, 5 Jul 2022 14:38:44 +0800 Subject: [PATCH] roojs-core.js roojs-core-debug.js roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- roojs-all.js | 7 ++++--- roojs-debug.js | 14 +++++++++++++- roojs-ui-debug.js | 14 +++++++++++++- roojs-ui.js | 7 ++++--- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/roojs-all.js b/roojs-all.js index 163ac296c4..be43b50389 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2897,9 +2897,10 @@ this.setCanvasPosition();}},onFooterButtonClick:function(e,el,o,A){switch(A){cas break;case 'download':this.download(e);break;default:break;}this.fireEvent('footerbuttonclick',this,A);},beforeSelectFile:function(e){e.preventDefault();if(this.fireEvent('beforeselectfile',this)!=false){this.selectorEl.dom.click();}},onFileSelected:function(e){e.preventDefault(); if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}var A=this.selectorEl.dom.files[0];if(this.fireEvent('inspect',this,A)!=false){this.prepare(A);}},trash:function(e){this.fireEvent('trash',this);},download:function(e){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(){this.imageEl.OriginWidth=this.imageEl.naturalWidth||this.imageEl.width; -this.imageEl.OriginHeight=this.imageEl.naturalHeight||this.imageEl.height;if(this.fireEvent('loadcanvas',this,this.imageEl)!=false){this.bodyEl.un('click',this.beforeSelectFile,this);this.notifyEl.hide();this.thumbEl.show();this.footerEl.show();this.baseRotateLevel(); -if(this.isDocument){this.setThumbBoxSize();}this.setThumbBoxPosition();this.baseScaleLevel();this.draw();this.resize();this.canvasLoaded=true;}if(this.loadMask){this.maskEl.unmask();}},setCanvasPosition:function(){if(!this.canvasEl){return;}var pw=Math.ceil((this.bodyEl.getWidth()-this.canvasEl.width)/2); -var ph=Math.ceil((this.bodyEl.getHeight()-this.canvasEl.height)/2);this.previewEl.setLeft(pw);this.previewEl.setTop(ph);},onMouseDown:function(e){e.stopEvent();this.dragable=true;this.pinching=false;if(this.isDocument&&(this.canvasEl.widthE)?C:E);F=(BF)?D:F);this.previewEl.setLeft(E);this.previewEl.setTop(F);this.mouseX=Roo.isTouch?e.browserEvent.touches[0].pageX:e.getPageX(); diff --git a/roojs-debug.js b/roojs-debug.js index 807e201a8b..7fa82854bb 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -68493,6 +68493,18 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { this.imageEl.OriginWidth = this.imageEl.naturalWidth || this.imageEl.width; this.imageEl.OriginHeight = this.imageEl.naturalHeight || this.imageEl.height; + if(this.imageEl.OriginWidth < this.minWidth) { + Roo.Msg.show({ + title: 'Error', + msg: "Image width should be at least 720", + buttons: {ok : true}, + fn: function(res) { + console.log("A"); + console.log(res); + } + }); + } + if(this.fireEvent('loadcanvas', this, this.imageEl) != false){ this.bodyEl.un('click', this.beforeSelectFile, this); @@ -68679,7 +68691,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { !this.isDocument && (this.rotate == 0 || this.rotate == 180) && ( - width < this.minWidth || // zoom out + width < this.minWidth || height < this.minHeight || width > maxWidth || height > maxHeight diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 66c9476c1d..80b2b60852 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -44001,6 +44001,18 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { this.imageEl.OriginWidth = this.imageEl.naturalWidth || this.imageEl.width; this.imageEl.OriginHeight = this.imageEl.naturalHeight || this.imageEl.height; + if(this.imageEl.OriginWidth < this.minWidth) { + Roo.Msg.show({ + title: 'Error', + msg: "Image width should be at least 720", + buttons: {ok : true}, + fn: function(res) { + console.log("A"); + console.log(res); + } + }); + } + if(this.fireEvent('loadcanvas', this, this.imageEl) != false){ this.bodyEl.un('click', this.beforeSelectFile, this); @@ -44187,7 +44199,7 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { !this.isDocument && (this.rotate == 0 || this.rotate == 180) && ( - width < this.minWidth || // zoom out + width < this.minWidth || height < this.minHeight || width > maxWidth || height > maxHeight diff --git a/roojs-ui.js b/roojs-ui.js index a8265b9bea..c36df8c538 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1951,9 +1951,10 @@ this.setCanvasPosition();}},onFooterButtonClick:function(e,el,o,A){switch(A){cas break;case 'download':this.download(e);break;default:break;}this.fireEvent('footerbuttonclick',this,A);},beforeSelectFile:function(e){e.preventDefault();if(this.fireEvent('beforeselectfile',this)!=false){this.selectorEl.dom.click();}},onFileSelected:function(e){e.preventDefault(); if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}var A=this.selectorEl.dom.files[0];if(this.fireEvent('inspect',this,A)!=false){this.prepare(A);}},trash:function(e){this.fireEvent('trash',this);},download:function(e){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(){this.imageEl.OriginWidth=this.imageEl.naturalWidth||this.imageEl.width; -this.imageEl.OriginHeight=this.imageEl.naturalHeight||this.imageEl.height;if(this.fireEvent('loadcanvas',this,this.imageEl)!=false){this.bodyEl.un('click',this.beforeSelectFile,this);this.notifyEl.hide();this.thumbEl.show();this.footerEl.show();this.baseRotateLevel(); -if(this.isDocument){this.setThumbBoxSize();}this.setThumbBoxPosition();this.baseScaleLevel();this.draw();this.resize();this.canvasLoaded=true;}if(this.loadMask){this.maskEl.unmask();}},setCanvasPosition:function(){if(!this.canvasEl){return;}var pw=Math.ceil((this.bodyEl.getWidth()-this.canvasEl.width)/2); -var ph=Math.ceil((this.bodyEl.getHeight()-this.canvasEl.height)/2);this.previewEl.setLeft(pw);this.previewEl.setTop(ph);},onMouseDown:function(e){e.stopEvent();this.dragable=true;this.pinching=false;if(this.isDocument&&(this.canvasEl.widthE)?C:E);F=(BF)?D:F);this.previewEl.setLeft(E);this.previewEl.setTop(F);this.mouseX=Roo.isTouch?e.browserEvent.touches[0].pageX:e.getPageX(); -- 2.39.2