From: leon Date: Tue, 5 Jul 2022 07:33:36 +0000 (+0800) Subject: roojs-core.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=a76469811480c99930e30ad2e4ce8d42002be886 roojs-core.js roojs-core-debug.js roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index fe99d4d405..163ac296c4 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2895,19 +2895,17 @@ this.bodyEl.on('mousemove',this.onMouseMove,this);var B=(/Firefox/i.test(navigat },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;this.notifyEl.dom.innerHTML=this.emptyText;},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){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){console.log("EMPTY RETURN");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;var A=this;var B="";if(this.imageEl.OriginWidthE)?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();this.mouseY=Roo.isTouch?e.browserEvent.touches[0].pageY:e.getPageY();},onMouseUp:function(e){e.stopEvent();this.dragable=false; -},onMouseWheel:function(e){e.stopEvent();this.startScale=this.scale;console.log("START SCALE: "+this.scale);this.scale=(e.getWheelDelta()==1)?(this.scale+1):(this.scale-1);console.log("END SCALE: "+this.scale);if(!this.zoomable()){this.scale=this.startScale; -return;}this.draw();return;},zoomable:function(){console.log("THUMBEL");console.log(this.thumbEl);var A=this.thumbEl.getWidth()/this.minWidth;if(this.minWidththis.minWidth/this.minHeight&&this.imageEl.OriginHeightE)?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(); +this.mouseY=Roo.isTouch?e.browserEvent.touches[0].pageY:e.getPageY();},onMouseUp:function(e){e.stopEvent();this.dragable=false;},onMouseWheel:function(e){e.stopEvent();this.startScale=this.scale;console.log("START SCALE: "+this.scale);this.scale=(e.getWheelDelta()==1)?(this.scale+1):(this.scale-1); +console.log("END SCALE: "+this.scale);if(!this.zoomable()){this.scale=this.startScale;return;}this.draw();return;},zoomable:function(){console.log("THUMBEL");console.log(this.thumbEl);var A=this.thumbEl.getWidth()/this.minWidth;if(this.minWidththis.minWidth/this.minHeight&&this.imageEl.OriginHeightthis.imageEl.OriginWidth||C>this.imageEl.OriginHeight||(Bthis.imageEl.OriginWidth||C>this.imageEl.OriginHeight||(BD||C>E)){return false; diff --git a/roojs-debug.js b/roojs-debug.js index 9f05d6a8cb..94acf4e377 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -68451,7 +68451,6 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { e.preventDefault(); if(typeof(this.selectorEl.dom.files) == 'undefined' || !this.selectorEl.dom.files.length){ - console.log("EMPTY RETURN"); return; } @@ -68493,31 +68492,7 @@ 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; - - var _this = this; - - var errorMsg = ""; - - if(this.imageEl.OriginWidth < this.minWidth) { - errorMsg = "Image width should be at least " + this.minWidth + "\n"; - } - - if(this.imageEl.OriginHeight < this.minHeight) { - errorMsg = "Image height should be at least " + this.minHeight + "\n"; - } - - if(errorMsg.length != '') { - Roo.Msg.show({ - title: 'Error', - msg: errorMsg, - buttons: {ok : true}, - fn: function(res) { - _this.selectorEl.dom.value = ''; - _this.selectorEl.dom.click(); - } - }); - } - + if(this.fireEvent('loadcanvas', this, this.imageEl) != false){ this.bodyEl.un('click', this.beforeSelectFile, this); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index bcd80ea653..d29f9688eb 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -43959,7 +43959,6 @@ Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { e.preventDefault(); if(typeof(this.selectorEl.dom.files) == 'undefined' || !this.selectorEl.dom.files.length){ - console.log("EMPTY RETURN"); return; } @@ -44001,31 +44000,7 @@ 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; - - var _this = this; - - var errorMsg = ""; - - if(this.imageEl.OriginWidth < this.minWidth) { - errorMsg = "Image width should be at least " + this.minWidth + "\n"; - } - - if(this.imageEl.OriginHeight < this.minHeight) { - errorMsg = "Image height should be at least " + this.minHeight + "\n"; - } - - if(errorMsg.length != '') { - Roo.Msg.show({ - title: 'Error', - msg: errorMsg, - buttons: {ok : true}, - fn: function(res) { - _this.selectorEl.dom.value = ''; - _this.selectorEl.dom.click(); - } - }); - } - + if(this.fireEvent('loadcanvas', this, this.imageEl) != false){ this.bodyEl.un('click', this.beforeSelectFile, this); diff --git a/roojs-ui.js b/roojs-ui.js index 9b3fa99a38..a8265b9bea 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1949,19 +1949,17 @@ this.bodyEl.on('mousemove',this.onMouseMove,this);var B=(/Firefox/i.test(navigat },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;this.notifyEl.dom.innerHTML=this.emptyText;},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){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){console.log("EMPTY RETURN");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;var A=this;var B="";if(this.imageEl.OriginWidthE)?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();this.mouseY=Roo.isTouch?e.browserEvent.touches[0].pageY:e.getPageY();},onMouseUp:function(e){e.stopEvent();this.dragable=false; -},onMouseWheel:function(e){e.stopEvent();this.startScale=this.scale;console.log("START SCALE: "+this.scale);this.scale=(e.getWheelDelta()==1)?(this.scale+1):(this.scale-1);console.log("END SCALE: "+this.scale);if(!this.zoomable()){this.scale=this.startScale; -return;}this.draw();return;},zoomable:function(){console.log("THUMBEL");console.log(this.thumbEl);var A=this.thumbEl.getWidth()/this.minWidth;if(this.minWidththis.minWidth/this.minHeight&&this.imageEl.OriginHeightE)?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(); +this.mouseY=Roo.isTouch?e.browserEvent.touches[0].pageY:e.getPageY();},onMouseUp:function(e){e.stopEvent();this.dragable=false;},onMouseWheel:function(e){e.stopEvent();this.startScale=this.scale;console.log("START SCALE: "+this.scale);this.scale=(e.getWheelDelta()==1)?(this.scale+1):(this.scale-1); +console.log("END SCALE: "+this.scale);if(!this.zoomable()){this.scale=this.startScale;return;}this.draw();return;},zoomable:function(){console.log("THUMBEL");console.log(this.thumbEl);var A=this.thumbEl.getWidth()/this.minWidth;if(this.minWidththis.minWidth/this.minHeight&&this.imageEl.OriginHeightthis.imageEl.OriginWidth||C>this.imageEl.OriginHeight||(Bthis.imageEl.OriginWidth||C>this.imageEl.OriginHeight||(BD||C>E)){return false;