From: Alan Date: Thu, 19 Jan 2023 08:03:46 +0000 (+0800) Subject: add missing files X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=f7822491d0a7de5be266db6cef8da0cdf123babb add missing files --- diff --git a/docs/src/Roo_dialog_UploadCropbox.js.html b/docs/src/Roo_dialog_UploadCropbox.js.html new file mode 100644 index 0000000000..3d65ea476d --- /dev/null +++ b/docs/src/Roo_dialog_UploadCropbox.js.html @@ -0,0 +1,1896 @@ +Roo/dialog/UploadCropbox.js +/* +* Licence: LGPL +*/ + +/** + * @class Roo.dialog.UploadCropbox + * @extends Roo.BoxComponent + * Dialog UploadCropbox class + * @cfg {String} emptyText show when image has been loaded + * @cfg {String} rotateNotify show when image too small to rotate + * @cfg {Number} errorTimeout default 3000 + * @cfg {Number} minWidth default 300 + * @cfg {Number} minHeight default 300 + * @cfg {Number} outputMaxWidth default 1200 + * @cfg {Number} windowSize default 300 + * @cfg {Array} buttons default ['rotateLeft', 'pictureBtn', 'rotateRight'] + * @cfg {Boolean} isDocument (true|false) default false + * @cfg {String} url action url + * @cfg {String} paramName default 'imageUpload' + * @cfg {String} method default POST + * @cfg {Boolean} loadMask (true|false) default true + * @cfg {Boolean} loadingText default 'Loading...' + * + * @constructor + * Create a new UploadCropbox + * @param {Object} config The config object + */ + + Roo.dialog.UploadCropbox = function(config){ + Roo.dialog.UploadCropbox.superclass.constructor.call(this, config); + + this.addEvents({ + /** + * @event beforeselectfile + * Fire before select file + * @param {Roo.dialog.UploadCropbox} this + */ + "beforeselectfile" : true, + /** + * @event initial + * Fire after initEvent + * @param {Roo.dialog.UploadCropbox} this + */ + "initial" : true, + /** + * @event crop + * Fire after initEvent + * @param {Roo.dialog.UploadCropbox} this + * @param {String} data + */ + "crop" : true, + /** + * @event prepare + * Fire when preparing the file data + * @param {Roo.dialog.UploadCropbox} this + * @param {Object} file + */ + "prepare" : true, + /** + * @event exception + * Fire when get exception + * @param {Roo.dialog.UploadCropbox} this + * @param {XMLHttpRequest} xhr + */ + "exception" : true, + /** + * @event beforeloadcanvas + * Fire before load the canvas + * @param {Roo.dialog.UploadCropbox} this + * @param {String} src + */ + "beforeloadcanvas" : true, + /** + * @event trash + * Fire when trash image + * @param {Roo.dialog.UploadCropbox} this + */ + "trash" : true, + /** + * @event download + * Fire when download the image + * @param {Roo.dialog.UploadCropbox} this + */ + "download" : true, + /** + * @event footerbuttonclick + * Fire when footerbuttonclick + * @param {Roo.dialog.UploadCropbox} this + * @param {String} type + */ + "footerbuttonclick" : true, + /** + * @event resize + * Fire when resize + * @param {Roo.dialog.UploadCropbox} this + */ + "resize" : true, + /** + * @event rotate + * Fire when rotate the image + * @param {Roo.dialog.UploadCropbox} this + * @param {String} pos + */ + "rotate" : true, + /** + * @event inspect + * Fire when inspect the file + * @param {Roo.dialog.UploadCropbox} this + * @param {Object} file + */ + "inspect" : true, + /** + * @event upload + * Fire when xhr upload the file + * @param {Roo.dialog.UploadCropbox} this + * @param {Object} data + */ + "upload" : true, + /** + * @event arrange + * Fire when arrange the file data + * @param {Roo.dialog.UploadCropbox} this + * @param {Object} formData + */ + "arrange" : true, + /** + * @event loadcanvas + * Fire after load the canvas + * @param {Roo.dialog.UploadCropbox} + * @param {Object} imgEl + */ + "loadcanvas" : true + }); + + this.buttons = this.buttons || Roo.dialog.UploadCropbox.footer.STANDARD; +}; + +Roo.extend(Roo.dialog.UploadCropbox, Roo.Component, { + + emptyText : 'Click to upload image', + rotateNotify : 'Image is too small to rotate', + errorTimeout : 3000, + scale : 0, + baseScale : 1, + rotate : 0, + dragable : false, + pinching : false, + mouseX : 0, + mouseY : 0, + cropData : false, + minWidth : 300, + minHeight : 300, + outputMaxWidth : 1200, + windowSize : 300, + file : false, + exif : {}, + baseRotate : 1, + cropType : 'image/jpeg', + buttons : false, + canvasLoaded : false, + isDocument : false, + method : 'POST', + paramName : 'imageUpload', + loadMask : true, + loadingText : 'Loading...', + maskEl : false, + + getAutoCreate : function() + { + var cfg = { + tag : 'div', + cls : 'roo-upload-cropbox', + cn : [ + { + tag : 'input', + cls : 'roo-upload-cropbox-selector', + type : 'file' + }, + { + tag : 'div', + cls : 'roo-upload-cropbox-body', + style : 'cursor:pointer', + 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-error-notify alert alert-danger', + html : this.rotateNotify + } + ] + }, + { + tag : 'div', + cls : 'roo-upload-cropbox-footer', + cn : { + tag : 'div', + cls : 'btn-group btn-group-justified roo-upload-cropbox-btn-group', + cn : [] + } + } + ] + }; + + return cfg; + }, + + onRender : function(ct, position) + { + Roo.dialog.UploadCropbox.superclass.onRender.call(this, ct, position); + + if(this.el){ + if (this.el.attr('xtype')) { + this.el.attr('xtypex', this.el.attr('xtype')); + this.el.dom.removeAttribute('xtype'); + + this.initEvents(); + } + } + else { + var cfg = Roo.apply({}, this.getAutoCreate()); + + cfg.id = this.id || Roo.id(); + + if (this.cls) { + cfg.cls = (typeof(cfg.cls) == 'undefined' ? this.cls : cfg.cls) + ' ' + this.cls; + } + + if (this.style) { // fixme needs to support more complex style data. + cfg.style = (typeof(cfg.style) == 'undefined' ? this.style : cfg.style) + '; ' + this.style; + } + + this.el = ct.createChild(cfg, position); + + this.initEvents(); + } + + if (this.buttons.length) { + + Roo.each(this.buttons, function(bb) { + + var btn = this.el.select('.roo-upload-cropbox-footer div.roo-upload-cropbox-btn-group').first().createChild(bb); + + btn.on('click', this.onFooterButtonClick.createDelegate(this, [bb.action], true)); + + }, this); + } + + if(this.loadMask){ + this.maskEl = this.el; + } + }, + + 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(); + this.bodyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block'; + + this.selectorEl = this.el.select('.roo-upload-cropbox-selector', true).first(); + this.selectorEl.hide(); + + this.previewEl = this.el.select('.roo-upload-cropbox-preview', true).first(); + this.previewEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block'; + + this.thumbEl = this.el.select('.roo-upload-cropbox-thumb', true).first(); + this.thumbEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block'; + this.thumbEl.hide(); + + this.notifyEl = this.el.select('.roo-upload-cropbox-empty-notify', true).first(); + this.notifyEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block'; + + this.errorEl = this.el.select('.roo-upload-cropbox-error-notify', true).first(); + this.errorEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block'; + this.errorEl.hide(); + + 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.resize(); + + this.fireEvent('initial', this); + }, + + bind : function() + { + var _this = this; + + window.addEventListener("resize", function() { _this.resize(); } ); + + this.bodyEl.on('click', this.beforeSelectFile, this); + + 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 mousewheel = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel'; + this.bodyEl.on(mousewheel, this.onMouseWheel, this); + Roo.get(document).on('mouseup', this.onMouseUp, this); + } + + this.selectorEl.on('change', this.onFileSelected, 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; + this.notifyEl.dom.innerHTML = this.emptyText; + + // this.selectorEl.dom.value = ''; + + }, + + resize : function() + { + if(this.fireEvent('resize', this) != false){ + this.setThumbBoxPosition(); + this.setCanvasPosition(); + } + }, + + onFooterButtonClick : function(e, el, o, type) + { + switch (type) { + 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; + case 'center' : + this.center(e); + break; + default : + break; + } + + this.fireEvent('footerbuttonclick', this, type); + }, + + 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 file = this.selectorEl.dom.files[0]; + + if(this.fireEvent('inspect', this, file) != false){ + this.prepare(file); + } + + }, + + trash : function(e) + { + this.fireEvent('trash', this); + }, + + download : function(e) + { + this.fireEvent('download', this); + }, + + center : function(e) + { + this.setCanvasPosition(); + }, + + loadCanvas : function(src) + { + if(this.fireEvent('beforeloadcanvas', this, src) != false){ + + this.reset(); + + this.imageEl = document.createElement('img'); + + var _this = this; + + this.imageEl.addEventListener("load", function(){ _this.onLoadCanvas(); }); + + this.imageEl.src = src; + } + }, + + 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(center = true) + { + if(!this.canvasEl){ + return; + } + + var newCenterLeft = Math.ceil((this.bodyEl.getWidth() - this.canvasEl.width) / 2); + var newCenterTop = Math.ceil((this.bodyEl.getHeight() - this.canvasEl.height) / 2); + + if(center) { + this.previewEl.setLeft(newCenterLeft); + this.previewEl.setTop(newCenterTop); + + return; + } + + var oldScaleLevel = this.baseScale * Math.pow(1.02, this.startScale); + var oldCanvasWidth = Math.floor(this.imageEl.OriginWidth * oldScaleLevel); + var oldCanvasHeight = Math.floor(this.imageEl.OriginHeight * oldScaleLevel); + + var oldCenterLeft = Math.ceil((this.bodyEl.getWidth() - oldCanvasWidth) / 2); + var oldCenterTop = Math.ceil((this.bodyEl.getHeight() - oldCanvasHeight) / 2); + + var leftDiff = newCenterLeft - oldCenterLeft; + var topDiff = newCenterTop - oldCenterTop; + + var newPreviewLeft = this.previewEl.getLeft(true) + leftDiff; + var newPreviewTop = this.previewEl.getTop(true) + topDiff; + + this.previewEl.setLeft(newPreviewLeft); + this.previewEl.setTop(newPreviewTop); + + }, + + onMouseDown : function(e) + { + e.stopEvent(); + + this.dragable = true; + this.pinching = false; + + if(this.isDocument && (this.canvasEl.width < this.thumbEl.getWidth() || this.canvasEl.height < this.thumbEl.getHeight())){ + this.dragable = false; + return; + } + + this.mouseX = Roo.isTouch ? e.browserEvent.touches[0].pageX : e.getPageX(); + this.mouseY = Roo.isTouch ? e.browserEvent.touches[0].pageY : e.getPageY(); + + }, + + onMouseMove : function(e) + { + e.stopEvent(); + + if(!this.canvasLoaded){ + return; + } + + if (!this.dragable){ + return; + } + + var maxPaddingLeft = this.canvasEl.width / 0.9 * 0.05; + var maxPaddingTop = maxPaddingLeft * this.minHeight / this.minWidth; + + if ((this.imageEl.OriginWidth / this.imageEl.OriginHeight <= this.minWidth / this.minHeight)) { + maxPaddingLeft = (this.canvasEl.height * this.minWidth / this.minHeight - this.canvasEl.width) / 2 + maxPaddingLeft; + } + + if ((this.imageEl.OriginWidth / this.imageEl.OriginHeight >= this.minWidth / this.minHeight)) { + maxPaddingTop = (this.canvasEl.width * this.minHeight / this.minWidth - this.canvasEl.height) / 2 + maxPaddingTop; + } + + var minX = Math.ceil(this.thumbEl.getLeft(true) + this.thumbEl.getWidth() - this.canvasEl.width - maxPaddingLeft); + var minY = Math.ceil(this.thumbEl.getTop(true) + this.thumbEl.getHeight() - this.canvasEl.height - maxPaddingTop); + + var maxX = Math.ceil(this.thumbEl.getLeft(true) + maxPaddingLeft); + var maxY = Math.ceil(this.thumbEl.getTop(true) + maxPaddingTop); + + if(minX > maxX) { + var tempX = minX; + minX = maxX; + maxX = tempX; + } + + if(minY > maxY) { + var tempY = minY; + minY = maxY; + maxY = tempY; + } + + var x = Roo.isTouch ? e.browserEvent.touches[0].pageX : e.getPageX(); + var y = Roo.isTouch ? e.browserEvent.touches[0].pageY : e.getPageY(); + + x = x - this.mouseX; + y = y - this.mouseY; + + var bgX = Math.ceil(x + this.previewEl.getLeft(true)); + var bgY = Math.ceil(y + this.previewEl.getTop(true)); + + bgX = (bgX < minX) ? minX : ((bgX > maxX) ? maxX : bgX); + bgY = (bgY < minY) ? minY : ((bgY > maxY) ? maxY : bgY); + + this.previewEl.setLeft(bgX); + this.previewEl.setTop(bgY); + + 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; + this.scale = (e.getWheelDelta() > 0) ? (this.scale + 1) : (this.scale - 1); + + if(!this.zoomable()){ + this.scale = this.startScale; + return; + } + + + this.draw(); + + return; + }, + + zoomable : function() + { + var minScale = this.thumbEl.getWidth() / this.minWidth; + + if(this.minWidth < this.minHeight){ + minScale = this.thumbEl.getHeight() / this.minHeight; + } + + 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; + + + var newCanvasWidth = Math.floor(this.imageEl.OriginWidth * this.getScaleLevel()); + var newCanvasHeight = Math.floor(this.imageEl.OriginHeight * this.getScaleLevel()); + + var oldCenterLeft = Math.ceil((this.bodyEl.getWidth() - this.canvasEl.width) / 2); + var oldCenterTop = Math.ceil((this.bodyEl.getHeight() - this.canvasEl.height) / 2); + + var newCenterLeft = Math.ceil((this.bodyEl.getWidth() - newCanvasWidth) / 2); + var newCenterTop = Math.ceil((this.bodyEl.getHeight() - newCanvasHeight) / 2); + + var leftDiff = newCenterLeft - oldCenterLeft; + var topDiff = newCenterTop - oldCenterTop; + + var newPreviewLeft = this.previewEl.getLeft(true) + leftDiff; + var newPreviewTop = this.previewEl.getTop(true) + topDiff; + + var paddingLeft = newPreviewLeft - this.thumbEl.getLeft(true); + var paddingTop = newPreviewTop - this.thumbEl.getTop(true); + + var paddingRight = this.thumbEl.getLeft(true) + this.thumbEl.getWidth() - newCanvasWidth - newPreviewLeft; + var paddingBottom = this.thumbEl.getTop(true) + this.thumbEl.getHeight() - newCanvasHeight - newPreviewTop; + + var maxPaddingLeft = newCanvasWidth / 0.9 * 0.05; + var maxPaddingTop = maxPaddingLeft * this.minHeight / this.minWidth; + + if ((this.imageEl.OriginWidth / this.imageEl.OriginHeight <= this.minWidth / this.minHeight)) { + maxPaddingLeft = (newCanvasHeight * this.minWidth / this.minHeight - newCanvasWidth) / 2 + maxPaddingLeft; + } + + if ((this.imageEl.OriginWidth / this.imageEl.OriginHeight >= this.minWidth / this.minHeight)) { + maxPaddingTop = (newCanvasWidth * this.minHeight / this.minWidth - newCanvasHeight) / 2 + maxPaddingTop; + } + + if( + this.isDocument && + (this.rotate == 0 || this.rotate == 180) && + ( + width > this.imageEl.OriginWidth || + height > this.imageEl.OriginHeight || + (width < this.minWidth && height < this.minHeight) + ) + ){ + return false; + } + + if( + this.isDocument && + (this.rotate == 90 || this.rotate == 270) && + ( + width > this.imageEl.OriginWidth || + height > this.imageEl.OriginHeight || + (width < this.minHeight && height < this.minWidth) + ) + ){ + return false; + } + + if( + !this.isDocument && + (this.rotate == 0 || this.rotate == 180) && + ( + // for zoom out + paddingLeft > maxPaddingLeft || + paddingRight > maxPaddingLeft || + paddingTop > maxPaddingTop || + paddingBottom > maxPaddingTop || + // for zoom in + width > maxWidth || + height > maxHeight + ) + ){ + return false; + } + + if( + !this.isDocument && + (this.rotate == 90 || this.rotate == 270) && + ( + width < this.minHeight || + width > this.imageEl.OriginWidth || + height < this.minWidth || + height > this.imageEl.OriginHeight + ) + ){ + return false; + } + + return true; + + }, + + onRotateLeft : function(e) + { + if(!this.isDocument && (this.canvasEl.height < this.thumbEl.getWidth() || this.canvasEl.width < this.thumbEl.getHeight())){ + + var minScale = this.thumbEl.getWidth() / this.minWidth; + + var bw = Math.ceil(this.canvasEl.width / this.getScaleLevel()); + var bh = Math.ceil(this.canvasEl.height / this.getScaleLevel()); + + this.startScale = this.scale; + + while (this.getScaleLevel() < minScale){ + + this.scale = this.scale + 1; + + if(!this.zoomable()){ + break; + } + + if( + Math.ceil(bw * this.getScaleLevel()) < this.thumbEl.getHeight() || + Math.ceil(bh * this.getScaleLevel()) < this.thumbEl.getWidth() + ){ + continue; + } + + this.rotate = (this.rotate < 90) ? 270 : this.rotate - 90; + + this.draw(); + + return; + } + + this.scale = this.startScale; + + this.onRotateFail(); + + return false; + } + + this.rotate = (this.rotate < 90) ? 270 : this.rotate - 90; + + if(this.isDocument){ + this.setThumbBoxSize(); + this.setThumbBoxPosition(); + this.setCanvasPosition(); + } + + this.draw(); + + this.fireEvent('rotate', this, 'left'); + + }, + + onRotateRight : function(e) + { + if(!this.isDocument && (this.canvasEl.height < this.thumbEl.getWidth() || this.canvasEl.width < this.thumbEl.getHeight())){ + + var minScale = this.thumbEl.getWidth() / this.minWidth; + + var bw = Math.ceil(this.canvasEl.width / this.getScaleLevel()); + var bh = Math.ceil(this.canvasEl.height / this.getScaleLevel()); + + this.startScale = this.scale; + + while (this.getScaleLevel() < minScale){ + + this.scale = this.scale + 1; + + if(!this.zoomable()){ + break; + } + + if( + Math.ceil(bw * this.getScaleLevel()) < this.thumbEl.getHeight() || + Math.ceil(bh * this.getScaleLevel()) < this.thumbEl.getWidth() + ){ + continue; + } + + this.rotate = (this.rotate > 180) ? 0 : this.rotate + 90; + + this.draw(); + + return; + } + + this.scale = this.startScale; + + this.onRotateFail(); + + return false; + } + + this.rotate = (this.rotate > 180) ? 0 : this.rotate + 90; + + if(this.isDocument){ + this.setThumbBoxSize(); + this.setThumbBoxPosition(); + this.setCanvasPosition(); + } + + this.draw(); + + this.fireEvent('rotate', this, 'right'); + }, + + onRotateFail : function() + { + this.errorEl.show(true); + + var _this = this; + + (function() { _this.errorEl.hide(true); }).defer(this.errorTimeout); + }, + + draw : function() + { + this.previewEl.dom.innerHTML = ''; + + var canvasEl = document.createElement("canvas"); + + var contextEl = canvasEl.getContext("2d"); + + canvasEl.width = this.imageEl.OriginWidth * this.getScaleLevel(); + canvasEl.height = this.imageEl.OriginWidth * this.getScaleLevel(); + var center = this.imageEl.OriginWidth / 2; + + if(this.imageEl.OriginWidth < this.imageEl.OriginHeight){ + canvasEl.width = this.imageEl.OriginHeight * this.getScaleLevel(); + canvasEl.height = this.imageEl.OriginHeight * this.getScaleLevel(); + center = this.imageEl.OriginHeight / 2; + } + + contextEl.scale(this.getScaleLevel(), this.getScaleLevel()); + + contextEl.translate(center, center); + contextEl.rotate(this.rotate * Math.PI / 180); + + contextEl.drawImage(this.imageEl, 0, 0, this.imageEl.OriginWidth, this.imageEl.OriginHeight, center * -1, center * -1, this.imageEl.OriginWidth, this.imageEl.OriginHeight); + + this.canvasEl = document.createElement("canvas"); + + this.contextEl = this.canvasEl.getContext("2d"); + + switch (this.rotate) { + case 0 : + + this.canvasEl.width = this.imageEl.OriginWidth * this.getScaleLevel(); + this.canvasEl.height = this.imageEl.OriginHeight * this.getScaleLevel(); + + this.contextEl.drawImage(canvasEl, 0, 0, this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + + break; + case 90 : + + this.canvasEl.width = this.imageEl.OriginHeight * this.getScaleLevel(); + this.canvasEl.height = this.imageEl.OriginWidth * this.getScaleLevel(); + + if(this.imageEl.OriginWidth > this.imageEl.OriginHeight){ + this.contextEl.drawImage(canvasEl, Math.abs(this.canvasEl.width - this.canvasEl.height), 0, this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + break; + } + + this.contextEl.drawImage(canvasEl, 0, 0, this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + + break; + case 180 : + + this.canvasEl.width = this.imageEl.OriginWidth * this.getScaleLevel(); + this.canvasEl.height = this.imageEl.OriginHeight * this.getScaleLevel(); + + if(this.imageEl.OriginWidth > this.imageEl.OriginHeight){ + this.contextEl.drawImage(canvasEl, 0, Math.abs(this.canvasEl.width - this.canvasEl.height), this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + break; + } + + this.contextEl.drawImage(canvasEl, Math.abs(this.canvasEl.width - this.canvasEl.height), 0, this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + + break; + case 270 : + + this.canvasEl.width = this.imageEl.OriginHeight * this.getScaleLevel(); + this.canvasEl.height = this.imageEl.OriginWidth * this.getScaleLevel(); + + if(this.imageEl.OriginWidth > this.imageEl.OriginHeight){ + this.contextEl.drawImage(canvasEl, 0, 0, this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + break; + } + + this.contextEl.drawImage(canvasEl, 0, Math.abs(this.canvasEl.width - this.canvasEl.height), this.canvasEl.width, this.canvasEl.height, 0, 0, this.canvasEl.width, this.canvasEl.height); + + break; + default : + break; + } + + this.previewEl.appendChild(this.canvasEl); + + this.setCanvasPosition(false); + }, + + crop : function() + { + if(!this.canvasLoaded){ + return; + } + + var imageCanvas = document.createElement("canvas"); + + var imageContext = imageCanvas.getContext("2d"); + + imageCanvas.width = (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? this.imageEl.OriginWidth : this.imageEl.OriginHeight; + imageCanvas.height = (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? this.imageEl.OriginWidth : this.imageEl.OriginHeight; + + var center = imageCanvas.width / 2; + + imageContext.translate(center, center); + + imageContext.rotate(this.rotate * Math.PI / 180); + + imageContext.drawImage(this.imageEl, 0, 0, this.imageEl.OriginWidth, this.imageEl.OriginHeight, center * -1, center * -1, this.imageEl.OriginWidth, this.imageEl.OriginHeight); + + var canvas = document.createElement("canvas"); + + var context = canvas.getContext("2d"); + + canvas.width = this.thumbEl.getWidth() / this.getScaleLevel(); + + canvas.height = this.thumbEl.getHeight() / this.getScaleLevel(); + + switch (this.rotate) { + case 0 : + + var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getWidth() / this.getScaleLevel()); + var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getHeight() / this.getScaleLevel()); + + var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel()); + var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel()); + + var sx = this.thumbEl.getLeft(true) - this.previewEl.getLeft(true); + var sy = this.thumbEl.getTop(true) - this.previewEl.getTop(true); + + sx = sx < 0 ? 0 : (sx / this.getScaleLevel()); + sy = sy < 0 ? 0 : (sy / this.getScaleLevel()); + + if(canvas.width > this.outputMaxWidth) { + var scale = this.outputMaxWidth / canvas.width; + canvas.width = canvas.width * scale; + canvas.height = canvas.height * scale; + context.scale(scale, scale); + } + + context.fillStyle = 'white'; + context.fillRect(0, 0, this.thumbEl.getWidth() / this.getScaleLevel(), this.thumbEl.getHeight() / this.getScaleLevel()); + + + context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height); + + break; + case 90 : + + var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getWidth() / this.getScaleLevel()); + var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getHeight() / this.getScaleLevel()); + + var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel()); + var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel()); + + var targetWidth = this.minWidth - 2 * x; + var targetHeight = this.minHeight - 2 * y; + + var scale = 1; + + if((x == 0 && y == 0) || (x == 0 && y > 0)){ + scale = targetWidth / width; + } + + if(x > 0 && y == 0){ + scale = targetHeight / height; + } + + if(x > 0 && y > 0){ + scale = targetWidth / width; + + if(width < height){ + scale = targetHeight / height; + } + } + + context.scale(scale, scale); + + var sx = Math.min(this.canvasEl.width - this.thumbEl.getWidth(), this.thumbEl.getLeft(true) - this.previewEl.getLeft(true)); + var sy = Math.min(this.canvasEl.height - this.thumbEl.getHeight(), this.thumbEl.getTop(true) - this.previewEl.getTop(true)); + + sx = sx < 0 ? 0 : (sx / this.getScaleLevel()); + sy = sy < 0 ? 0 : (sy / this.getScaleLevel()); + + sx += (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? Math.abs(this.imageEl.OriginWidth - this.imageEl.OriginHeight) : 0; + + context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height); + + break; + case 180 : + + var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getWidth() / this.getScaleLevel()); + var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getHeight() / this.getScaleLevel()); + + var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel()); + var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel()); + + var targetWidth = this.minWidth - 2 * x; + var targetHeight = this.minHeight - 2 * y; + + var scale = 1; + + if((x == 0 && y == 0) || (x == 0 && y > 0)){ + scale = targetWidth / width; + } + + if(x > 0 && y == 0){ + scale = targetHeight / height; + } + + if(x > 0 && y > 0){ + scale = targetWidth / width; + + if(width < height){ + scale = targetHeight / height; + } + } + + context.scale(scale, scale); + + var sx = Math.min(this.canvasEl.width - this.thumbEl.getWidth(), this.thumbEl.getLeft(true) - this.previewEl.getLeft(true)); + var sy = Math.min(this.canvasEl.height - this.thumbEl.getHeight(), this.thumbEl.getTop(true) - this.previewEl.getTop(true)); + + sx = sx < 0 ? 0 : (sx / this.getScaleLevel()); + sy = sy < 0 ? 0 : (sy / this.getScaleLevel()); + + sx += (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? 0 : Math.abs(this.imageEl.OriginWidth - this.imageEl.OriginHeight); + sy += (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? Math.abs(this.imageEl.OriginWidth - this.imageEl.OriginHeight) : 0; + + context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height); + + break; + case 270 : + + var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getWidth() / this.getScaleLevel()); + var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getHeight() / this.getScaleLevel()); + + var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel()); + var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel()); + + var targetWidth = this.minWidth - 2 * x; + var targetHeight = this.minHeight - 2 * y; + + var scale = 1; + + if((x == 0 && y == 0) || (x == 0 && y > 0)){ + scale = targetWidth / width; + } + + if(x > 0 && y == 0){ + scale = targetHeight / height; + } + + if(x > 0 && y > 0){ + scale = targetWidth / width; + + if(width < height){ + scale = targetHeight / height; + } + } + + context.scale(scale, scale); + var sx = Math.min(this.canvasEl.width - this.thumbEl.getWidth(), this.thumbEl.getLeft(true) - this.previewEl.getLeft(true)); + var sy = Math.min(this.canvasEl.height - this.thumbEl.getHeight(), this.thumbEl.getTop(true) - this.previewEl.getTop(true)); + + sx = sx < 0 ? 0 : (sx / this.getScaleLevel()); + sy = sy < 0 ? 0 : (sy / this.getScaleLevel()); + + sy += (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? 0 : Math.abs(this.imageEl.OriginWidth - this.imageEl.OriginHeight); + + context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height); + + break; + default : + break; + } + + this.cropData = canvas.toDataURL(this.cropType); + + if(this.fireEvent('crop', this, this.cropData) !== false){ + this.process(this.file, this.cropData); + } + + return; + + }, + + setThumbBoxSize : function() + { + var width, height; + + if(this.isDocument && typeof(this.imageEl) != 'undefined'){ + width = (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? Math.max(this.minWidth, this.minHeight) : Math.min(this.minWidth, this.minHeight); + height = (this.imageEl.OriginWidth > this.imageEl.OriginHeight) ? Math.min(this.minWidth, this.minHeight) : Math.max(this.minWidth, this.minHeight); + + this.minWidth = width; + this.minHeight = height; + + if(this.rotate == 90 || this.rotate == 270){ + this.minWidth = height; + this.minHeight = width; + } + } + + height = this.windowSize; + width = Math.ceil(this.minWidth * height / this.minHeight); + + if(this.minWidth > this.minHeight){ + width = this.windowSize; + height = Math.ceil(this.minHeight * width / this.minWidth); + } + + this.thumbEl.setStyle({ + width : width + 'px', + height : height + 'px' + }); + + return; + + }, + + setThumbBoxPosition : function() + { + var x = Math.ceil((this.bodyEl.getWidth() - this.thumbEl.getWidth()) / 2 ); + var y = Math.ceil((this.bodyEl.getHeight() - this.thumbEl.getHeight()) / 2); + + this.thumbEl.setLeft(x); + this.thumbEl.setTop(y); + + }, + + baseRotateLevel : function() + { + this.baseRotate = 1; + + if( + typeof(this.exif) != 'undefined' && + typeof(this.exif[Roo.dialog.UploadCropbox['tags']['Orientation']]) != 'undefined' && + [1, 3, 6, 8].indexOf(this.exif[Roo.dialog.UploadCropbox['tags']['Orientation']]) != -1 + ){ + this.baseRotate = this.exif[Roo.dialog.UploadCropbox['tags']['Orientation']]; + } + + this.rotate = Roo.dialog.UploadCropbox['Orientation'][this.baseRotate]; + + }, + + baseScaleLevel : function() + { + var width, height; + + if(this.isDocument){ + + if(this.baseRotate == 6 || this.baseRotate == 8){ + + height = this.thumbEl.getHeight(); + this.baseScale = height / this.imageEl.OriginWidth; + + if(this.imageEl.OriginHeight * this.baseScale > this.thumbEl.getWidth()){ + width = this.thumbEl.getWidth(); + this.baseScale = width / this.imageEl.OriginHeight; + } + + return; + } + + height = this.thumbEl.getHeight(); + this.baseScale = height / this.imageEl.OriginHeight; + + if(this.imageEl.OriginWidth * this.baseScale > this.thumbEl.getWidth()){ + width = this.thumbEl.getWidth(); + this.baseScale = width / this.imageEl.OriginWidth; + } + + return; + } + + if(this.baseRotate == 6 || this.baseRotate == 8){ + + width = this.thumbEl.getHeight(); + this.baseScale = width / this.imageEl.OriginHeight; + + if(this.imageEl.OriginHeight * this.baseScale < this.thumbEl.getWidth()){ + height = this.thumbEl.getWidth(); + this.baseScale = height / this.imageEl.OriginHeight; + } + + if(this.imageEl.OriginWidth > this.imageEl.OriginHeight){ + height = this.thumbEl.getWidth(); + this.baseScale = height / this.imageEl.OriginHeight; + + if(this.imageEl.OriginWidth * this.baseScale < this.thumbEl.getHeight()){ + width = this.thumbEl.getHeight(); + this.baseScale = width / this.imageEl.OriginWidth; + } + } + + return; + } + + width = this.thumbEl.getWidth(); + this.baseScale = width / this.imageEl.OriginWidth; + + if(this.imageEl.OriginHeight * this.baseScale < this.thumbEl.getHeight()){ + height = this.thumbEl.getHeight(); + this.baseScale = height / this.imageEl.OriginHeight; + } + + if(this.imageEl.OriginWidth > this.imageEl.OriginHeight){ + + height = this.thumbEl.getHeight(); + this.baseScale = height / this.imageEl.OriginHeight; + + if(this.imageEl.OriginWidth * this.baseScale < this.thumbEl.getWidth()){ + width = this.thumbEl.getWidth(); + this.baseScale = width / this.imageEl.OriginWidth; + } + + } + + if(this.imageEl.OriginWidth < this.minWidth || this.imageEl.OriginHeight < this.minHeight) { + this.baseScale = width / this.minWidth; + } + + return; + }, + + getScaleLevel : function() + { + return this.baseScale * Math.pow(1.02, this.scale); + }, + + onTouchStart : function(e) + { + if(!this.canvasLoaded){ + this.beforeSelectFile(e); + return; + } + + var touches = e.browserEvent.touches; + + if(!touches){ + return; + } + + if(touches.length == 1){ + this.onMouseDown(e); + return; + } + + if(touches.length != 2){ + return; + } + + var coords = []; + + for(var i = 0, finger; finger = touches[i]; i++){ + coords.push(finger.pageX, finger.pageY); + } + + var x = Math.pow(coords[0] - coords[2], 2); + var y = Math.pow(coords[1] - coords[3], 2); + + this.startDistance = Math.sqrt(x + y); + + this.startScale = this.scale; + + this.pinching = true; + this.dragable = false; + + }, + + onTouchMove : function(e) + { + if(!this.pinching && !this.dragable){ + return; + } + + var touches = e.browserEvent.touches; + + if(!touches){ + return; + } + + if(this.dragable){ + this.onMouseMove(e); + return; + } + + var coords = []; + + for(var i = 0, finger; finger = touches[i]; i++){ + coords.push(finger.pageX, finger.pageY); + } + + var x = Math.pow(coords[0] - coords[2], 2); + var y = Math.pow(coords[1] - coords[3], 2); + + this.endDistance = Math.sqrt(x + y); + + this.scale = this.startScale + Math.floor(Math.log(this.endDistance / this.startDistance) / Math.log(1.1)); + + if(!this.zoomable()){ + this.scale = this.startScale; + return; + } + + this.draw(); + + }, + + onTouchEnd : function(e) + { + this.pinching = false; + this.dragable = false; + + }, + + process : function(file, crop) + { + if(this.loadMask){ + this.maskEl.mask(this.loadingText); + } + + this.xhr = new XMLHttpRequest(); + + file.xhr = this.xhr; + + this.xhr.open(this.method, this.url, true); + + var headers = { + "Accept": "application/json", + "Cache-Control": "no-cache", + "X-Requested-With": "XMLHttpRequest" + }; + + for (var headerName in headers) { + var headerValue = headers[headerName]; + if (headerValue) { + this.xhr.setRequestHeader(headerName, headerValue); + } + } + + var _this = this; + + this.xhr.onload = function() + { + _this.xhrOnLoad(_this.xhr); + } + + this.xhr.onerror = function() + { + _this.xhrOnError(_this.xhr); + } + + var formData = new FormData(); + + formData.append('returnHTML', 'NO'); + + if(crop){ + formData.append('crop', crop); + var blobBin = atob(crop.split(',')[1]); + var array = []; + for(var i = 0; i < blobBin.length; i++) { + array.push(blobBin.charCodeAt(i)); + } + var croppedFile =new Blob([new Uint8Array(array)], {type: this.cropType}); + formData.append(this.paramName, croppedFile, file.name); + } + + if(typeof(file.filename) != 'undefined'){ + formData.append('filename', file.filename); + } + + if(typeof(file.mimetype) != 'undefined'){ + formData.append('mimetype', file.mimetype); + } + + if(this.fireEvent('arrange', this, formData) != false){ + this.xhr.send(formData); + }; + }, + + xhrOnLoad : function(xhr) + { + if(this.loadMask){ + this.maskEl.unmask(); + } + + if (xhr.readyState !== 4) { + this.fireEvent('exception', this, xhr); + return; + } + + var response = Roo.decode(xhr.responseText); + + if(!response.success){ + this.fireEvent('exception', this, xhr); + return; + } + + var response = Roo.decode(xhr.responseText); + + this.fireEvent('upload', this, response); + + }, + + xhrOnError : function() + { + if(this.loadMask){ + this.maskEl.unmask(); + } + + Roo.log('xhr on error'); + + var response = Roo.decode(xhr.responseText); + + Roo.log(response); + + }, + + prepare : function(file) + { + if(this.loadMask){ + this.maskEl.mask(this.loadingText); + } + + this.file = false; + this.exif = {}; + + if(typeof(file) === 'string'){ + this.loadCanvas(file); + return; + } + + if(!file || !this.urlAPI){ + return; + } + + this.file = file; + if(typeof(file.type) != 'undefined' && file.type.length != 0) { + this.cropType = file.type; + } + + var _this = this; + + if(this.fireEvent('prepare', this, this.file) != false){ + + var reader = new FileReader(); + + reader.onload = function (e) { + if (e.target.error) { + Roo.log(e.target.error); + return; + } + + var buffer = e.target.result, + dataView = new DataView(buffer), + offset = 2, + maxOffset = dataView.byteLength - 4, + markerBytes, + markerLength; + + if (dataView.getUint16(0) === 0xffd8) { + while (offset < maxOffset) { + markerBytes = dataView.getUint16(offset); + + if ((markerBytes >= 0xffe0 && markerBytes <= 0xffef) || markerBytes === 0xfffe) { + markerLength = dataView.getUint16(offset + 2) + 2; + if (offset + markerLength > dataView.byteLength) { + Roo.log('Invalid meta data: Invalid segment size.'); + break; + } + + if(markerBytes == 0xffe1){ + _this.parseExifData( + dataView, + offset, + markerLength + ); + } + + offset += markerLength; + + continue; + } + + break; + } + + } + + var url = _this.urlAPI.createObjectURL(_this.file); + + _this.loadCanvas(url); + + return; + } + + reader.readAsArrayBuffer(this.file); + + } + + }, + + parseExifData : function(dataView, offset, length) + { + var tiffOffset = offset + 10, + littleEndian, + dirOffset; + + if (dataView.getUint32(offset + 4) !== 0x45786966) { + // No Exif data, might be XMP data instead + return; + } + + // Check for the ASCII code for "Exif" (0x45786966): + if (dataView.getUint32(offset + 4) !== 0x45786966) { + // No Exif data, might be XMP data instead + return; + } + if (tiffOffset + 8 > dataView.byteLength) { + Roo.log('Invalid Exif data: Invalid segment size.'); + return; + } + // Check for the two null bytes: + if (dataView.getUint16(offset + 8) !== 0x0000) { + Roo.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + // Check the byte alignment: + switch (dataView.getUint16(tiffOffset)) { + case 0x4949: + littleEndian = true; + break; + case 0x4D4D: + littleEndian = false; + break; + default: + Roo.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + // Check for the TIFF tag marker (0x002A): + if (dataView.getUint16(tiffOffset + 2, littleEndian) !== 0x002A) { + Roo.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32(tiffOffset + 4, littleEndian); + + this.parseExifTags( + dataView, + tiffOffset, + tiffOffset + dirOffset, + littleEndian + ); + }, + + parseExifTags : function(dataView, tiffOffset, dirOffset, littleEndian) + { + var tagsNumber, + dirEndOffset, + i; + if (dirOffset + 6 > dataView.byteLength) { + Roo.log('Invalid Exif data: Invalid directory offset.'); + return; + } + tagsNumber = dataView.getUint16(dirOffset, littleEndian); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + if (dirEndOffset + 4 > dataView.byteLength) { + Roo.log('Invalid Exif data: Invalid directory size.'); + return; + } + for (i = 0; i < tagsNumber; i += 1) { + this.parseExifTag( + dataView, + tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian + ); + } + // Return the offset to the next directory: + return dataView.getUint32(dirEndOffset, littleEndian); + }, + + parseExifTag : function (dataView, tiffOffset, offset, littleEndian) + { + var tag = dataView.getUint16(offset, littleEndian); + + this.exif[tag] = this.getExifValue( + dataView, + tiffOffset, + offset, + dataView.getUint16(offset + 2, littleEndian), // tag type + dataView.getUint32(offset + 4, littleEndian), // tag length + littleEndian + ); + }, + + getExifValue : function (dataView, tiffOffset, offset, type, length, littleEndian) + { + var tagType = Roo.dialog.UploadCropbox.exifTagTypes[type], + tagSize, + dataOffset, + values, + i, + str, + c; + + if (!tagType) { + Roo.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? + tiffOffset + dataView.getUint32(offset + 8, littleEndian) : (offset + 8); + if (dataOffset + tagSize > dataView.byteLength) { + Roo.log('Invalid Exif data: Invalid data offset.'); + return; + } + if (length === 1) { + return tagType.getValue(dataView, dataOffset, littleEndian); + } + values = []; + for (i = 0; i < length; i += 1) { + values[i] = tagType.getValue(dataView, dataOffset + i * tagType.size, littleEndian); + } + + if (tagType.ascii) { + str = ''; + // Concatenate the chars: + for (i = 0; i < values.length; i += 1) { + c = values[i]; + // Ignore the terminating NULL byte(s): + if (c === '\u0000') { + break; + } + str += c; + } + return str; + } + return values; + } + +}); + +Roo.apply(Roo.dialog.UploadCropbox, { + tags : { + 'Orientation': 0x0112 + }, + + Orientation: { + 1: 0, //'top-left', +// 2: 'top-right', + 3: 180, //'bottom-right', +// 4: 'bottom-left', +// 5: 'left-top', + 6: 90, //'right-top', +// 7: 'right-bottom', + 8: 270 //'left-bottom' + }, + + exifTagTypes : { + // byte, 8-bit unsigned int: + 1: { + getValue: function (dataView, dataOffset) { + return dataView.getUint8(dataOffset); + }, + size: 1 + }, + // ascii, 8-bit byte: + 2: { + getValue: function (dataView, dataOffset) { + return String.fromCharCode(dataView.getUint8(dataOffset)); + }, + size: 1, + ascii: true + }, + // short, 16 bit int: + 3: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint16(dataOffset, littleEndian); + }, + size: 2 + }, + // long, 32 bit int: + 4: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint32(dataOffset, littleEndian); + }, + size: 4 + }, + // rational = two long values, first is numerator, second is denominator: + 5: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getUint32(dataOffset, littleEndian) / + dataView.getUint32(dataOffset + 4, littleEndian); + }, + size: 8 + }, + // slong, 32 bit signed int: + 9: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getInt32(dataOffset, littleEndian); + }, + size: 4 + }, + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function (dataView, dataOffset, littleEndian) { + return dataView.getInt32(dataOffset, littleEndian) / + dataView.getInt32(dataOffset + 4, littleEndian); + }, + size: 8 + } + }, + + footer : { + STANDARD : [ + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-left', + action : 'rotate-left', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-undo"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-picture', + action : 'picture', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-picture-o"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-right', + action : 'rotate-right', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-repeat"></i>' + } + ] + } + ], + DOCUMENT : [ + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-left', + action : 'rotate-left', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-undo"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-download', + action : 'download', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-download"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-crop', + action : 'crop', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-crop"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-trash', + action : 'trash', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-trash"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-right', + action : 'rotate-right', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-repeat"></i>' + } + ] + } + ], + ROTATOR : [ + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-left', + action : 'rotate-left', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-undo"></i>' + } + ] + }, + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-rotate-right', + action : 'rotate-right', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : '<i class="fa fa-repeat"></i>' + } + ] + } + ], + CENTER : [ + { + tag : 'div', + cls : 'btn-group roo-upload-cropbox-center', + action : 'center', + cn : [ + { + tag : 'button', + cls : 'btn btn-default', + html : 'CENTER' + } + ] + } + ] + } +}); + \ No newline at end of file diff --git a/docs/src/Roo_dialog_namespace.js.html b/docs/src/Roo_dialog_namespace.js.html new file mode 100644 index 0000000000..feb524b2dc --- /dev/null +++ b/docs/src/Roo_dialog_namespace.js.html @@ -0,0 +1 @@ +Roo/dialog/namespace.jsRoo.dialog = {}; \ No newline at end of file diff --git a/docs/symbols/Roo.dialog.UploadCropbox.json b/docs/symbols/Roo.dialog.UploadCropbox.json new file mode 100644 index 0000000000..f0c1408a53 --- /dev/null +++ b/docs/symbols/Roo.dialog.UploadCropbox.json @@ -0,0 +1,1769 @@ +{ + "name" : "Roo.dialog.UploadCropbox", + "augments" : [ + "Roo.BoxComponent", + "Roo.Component", + "Roo.util.Observable" + ], + "childClasses" : { }, + "tree_children" : [], + "tree_parent" : [], + "desc" : "Dialog UploadCropbox class", + "isSingleton" : false, + "isStatic" : false, + "isBuiltin" : false, + "isAbstract" : false, + "isBuilderTop" : false, + "memberOf" : "UploadCropbox", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "config", + "type" : "Object", + "desc" : "The config object", + "isOptional" : false + } + ], + "returns" : [], + "throws" : "", + "requires" : "", + "config" : [ + { + "name" : "listeners", + "type" : "Object", + "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "memberOf" : "Roo.util.Observable", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "errorTimeout", + "type" : "Number", + "desc" : "default 3000", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "windowSize", + "type" : "Number", + "desc" : "default 300", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "buttons", + "type" : "Array", + "desc" : "default ['rotateLeft', 'pictureBtn', 'rotateRight']", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "hideMode", + "type" : "String", + "desc" : "y)\nHow this component should hidden. Supported values are\n\"visibility\" (css visibility), \"offsets\" (negative offset position) and\n\"display\" (css display) - defaults to \"display", + "memberOf" : "Roo.Component", + "isOptional" : false, + "optvals" : [ + "display", + "visibility" + ] + }, + { + "name" : "emptyText", + "type" : "String", + "desc" : "show when image has been loaded", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "minWidth", + "type" : "Number", + "desc" : "default 300", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "outputMaxWidth", + "type" : "Number", + "desc" : "default 1200", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "method", + "type" : "String", + "desc" : "default POST", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "style", + "type" : "String", + "desc" : "css styles to add to component\neg. text-align:right;", + "memberOf" : "Roo.Component", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "allowDomMove", + "type" : "Boolean", + "desc" : "Whether the component can move the Dom node when rendering (defaults to true).", + "memberOf" : "Roo.Component", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "paramName", + "type" : "String", + "desc" : "default 'imageUpload'", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "minHeight", + "type" : "Number", + "desc" : "default 300", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "isDocument", + "type" : "Boolean", + "desc" : "e) default fal", + "memberOf" : "", + "isOptional" : false, + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "loadMask", + "type" : "Boolean", + "desc" : "e) default tr", + "memberOf" : "", + "isOptional" : false, + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "actionMode", + "type" : "String", + "desc" : "which property holds the element that used for hide() / show() / disable() / enable()\ndefault is 'el' for forms you probably want to set this to fieldEl", + "memberOf" : "Roo.Component", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "width", + "type" : "Number", + "desc" : "width (optional) size of component", + "memberOf" : "Roo.BoxComponent", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "rotateNotify", + "type" : "String", + "desc" : "show when image too small to rotate", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "url", + "type" : "String", + "desc" : "action url", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "height", + "type" : "Number", + "desc" : "height (optional) size of component", + "memberOf" : "Roo.BoxComponent", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "disableClass", + "type" : "String", + "desc" : "CSS class added to the component when it is disabled (defaults to \"x-item-disabled\").", + "memberOf" : "Roo.Component", + "isOptional" : false, + "optvals" : [] + }, + { + "name" : "loadingText", + "type" : "Boolean", + "desc" : "default 'Loading...'", + "memberOf" : "", + "isOptional" : false, + "optvals" : [] + } + ], + "methods" : [ + { + "name" : "updateBox", + "type" : "function", + "desc" : "Sets the current box measurements of the component's underlying element.", + "sig" : "(box)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "box", + "type" : "Object", + "desc" : "An object in the format {x, y, width, height}", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "setPagePosition", + "type" : "function", + "desc" : "Sets the page XY position of the component. To set the left and top instead, use {@link #setPosition}.\nThis method fires the move event.", + "sig" : "(x, y)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "x", + "type" : "Number", + "desc" : "The new x position", + "isOptional" : false + }, + { + "name" : "y", + "type" : "Number", + "desc" : "The new y position", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "syncSize", + "type" : "function", + "desc" : "Force the component's size to recalculate based on the underlying element's current height and width.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [] + }, + { + "name" : "setSize", + "type" : "function", + "desc" : "Sets the width and height of the component. This method fires the resize event. This method can accept\neither width and height as separate numeric arguments, or you can pass a size object like {width:10, height:20}.", + "sig" : "(width, height)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "width", + "type" : "Number/Object", + "desc" : "The new width to set, or a size object in the format {width, height}", + "isOptional" : false + }, + { + "name" : "height", + "type" : "Number", + "desc" : "The new height to set (not required if a size object is passed as the first arg)", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Roo.BoxComponent", + "desc" : "this" + } + ] + }, + { + "name" : "getPosition", + "type" : "function", + "desc" : "Gets the current XY position of the component's underlying element.", + "sig" : "(local)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "local", + "type" : "Boolean", + "desc" : "(optional) If true the element's left and top are returned instead of page XY (defaults to false)", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Array", + "desc" : "The XY position of the element (e.g., [100, 200])" + } + ] + }, + { + "name" : "onResize", + "type" : "function", + "desc" : "Called after the component is resized, this method is empty by default but can be implemented by any\nsubclass that needs to perform custom logic after a resize occurs.", + "sig" : "(adjWidth, adjHeight, rawWidth, rawHeight)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "adjWidth", + "type" : "Number", + "desc" : "The box-adjusted width that was set", + "isOptional" : false + }, + { + "name" : "adjHeight", + "type" : "Number", + "desc" : "The box-adjusted height that was set", + "isOptional" : false + }, + { + "name" : "rawWidth", + "type" : "Number", + "desc" : "The width that was originally specified", + "isOptional" : false + }, + { + "name" : "rawHeight", + "type" : "Number", + "desc" : "The height that was originally specified", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "getBox", + "type" : "function", + "desc" : "Gets the current box measurements of the component's underlying element.", + "sig" : "(local)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "local", + "type" : "Boolean", + "desc" : "(optional) If true the element's left and top are returned instead of page XY (defaults to false)", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "getSize", + "type" : "function", + "desc" : "Gets the current size of the component's underlying element.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Object", + "desc" : "An object containing the element's size {width: (element width), height: (element height)}" + } + ] + }, + { + "name" : "onPosition", + "type" : "function", + "desc" : "Called after the component is moved, this method is empty by default but can be implemented by any\nsubclass that needs to perform custom logic after a move occurs.", + "sig" : "(x, y)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "x", + "type" : "Number", + "desc" : "The new x position", + "isOptional" : false + }, + { + "name" : "y", + "type" : "Number", + "desc" : "The new y position", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "setPosition", + "type" : "function", + "desc" : "Sets the left and top of the component. To set the page XY position instead, use {@link #setPagePosition}.\nThis method fires the move event.", + "sig" : "(left, top)", + "static" : false, + "memberOf" : "Roo.BoxComponent", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "left", + "type" : "Number", + "desc" : "The new left", + "isOptional" : false + }, + { + "name" : "top", + "type" : "Number", + "desc" : "The new top", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "getId", + "type" : "function", + "desc" : "Returns the id of this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "String", + "desc" : "" + } + ] + }, + { + "name" : "render", + "type" : "function", + "desc" : "If this is a lazy rendering component, render it to its container element.", + "sig" : "(container)", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "container", + "type" : "String/HTMLElement/Element", + "desc" : "(optional) The element this component should be rendered into. If it is being applied to existing markup, this should be left off.", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Destroys this component by purging any event listeners, removing the component's element from the DOM,\nremoving the component from its {@link Roo.Container} (if applicable) and unregistering it from {@link Roo.ComponentMgr}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [] + }, + { + "name" : "isVisible", + "type" : "function", + "desc" : "Returns true if this component is visible.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [] + }, + { + "name" : "setDisabled", + "type" : "function", + "desc" : "Convenience function for setting disabled/enabled by boolean.", + "sig" : "(disabled)", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "disabled", + "type" : "Boolean", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Hide this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "focus", + "type" : "function", + "desc" : "Try to focus this component.", + "sig" : "(selectText)", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "selectText", + "type" : "Boolean", + "desc" : "True to also select the text in this component (if applicable)", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "show", + "type" : "function", + "desc" : "Show this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Enable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "setVisible", + "type" : "function", + "desc" : "Convenience function to hide or show this component by boolean.", + "sig" : "(visible)", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "visible", + "type" : "Boolean", + "desc" : "True to show, false to hide", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Disable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Roo.Component", + "desc" : "this" + } + ] + }, + { + "name" : "getEl", + "type" : "function", + "desc" : "Returns the underlying {@link Roo.Element}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [ + { + "name" : "", + "type" : "Roo.Element", + "desc" : "The element" + } + ] + }, + { + "name" : "purgeListeners", + "type" : "function", + "desc" : "Removes all listeners for this object", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [], + "returns" : [] + }, + { + "name" : "on", + "type" : "function", + "desc" : "Appends an event handler to this element (shorthand for addListener)", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "The type of event to listen for", + "isOptional" : false + }, + { + "name" : "handler", + "type" : "Function", + "desc" : "The method the event invokes", + "isOptional" : false + }, + { + "name" : "scope", + "type" : "Object", + "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.", + "isOptional" : false + }, + { + "name" : "options", + "type" : "Object", + "desc" : "(optional)", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "un", + "type" : "function", + "desc" : "Removes a listener (shorthand for removeListener)", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "The type of event to listen for", + "isOptional" : false + }, + { + "name" : "handler", + "type" : "Function", + "desc" : "The handler to remove", + "isOptional" : false + }, + { + "name" : "scope", + "type" : "Object", + "desc" : "(optional) The scope (this object) for the handler", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "addEvents", + "type" : "function", + "desc" : "Used to define events on this Observable", + "sig" : "(object)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "object", + "type" : "Object", + "desc" : "The object with the events defined", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "releaseCapture", + "type" : "function", + "desc" : "Removes all added captures from the Observable.", + "sig" : "(o)", + "static" : true, + "memberOf" : "Roo.util.Observable", + "isStatic" : true, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "o", + "type" : "Observable", + "desc" : "The Observable to release", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "removeListener", + "type" : "function", + "desc" : "Removes a listener", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "The type of event to listen for", + "isOptional" : false + }, + { + "name" : "handler", + "type" : "Function", + "desc" : "The handler to remove", + "isOptional" : false + }, + { + "name" : "scope", + "type" : "Object", + "desc" : "(optional) The scope (this object) for the handler", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "fireEvent", + "type" : "function", + "desc" : "Fires the specified event with the passed parameters (minus the event name).", + "sig" : "(eventName, args)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "", + "isOptional" : false + }, + { + "name" : "args", + "type" : "Object...", + "desc" : "Variable number of parameters are passed to handlers", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Boolean", + "desc" : "returns false if any of the handlers return false otherwise it returns true" + } + ] + }, + { + "name" : "hasListener", + "type" : "function", + "desc" : "Checks to see if this object has any listeners for a specified event", + "sig" : "(eventName)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "The name of the event to check for", + "isOptional" : false + } + ], + "returns" : [ + { + "name" : "", + "type" : "Boolean", + "desc" : "True if the event is being listened for, else false" + } + ] + }, + { + "name" : "capture", + "type" : "function", + "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\nbefore the event is fired. If the supplied function returns false,\nthe event will not fire.", + "sig" : "(o, fn, scope)", + "static" : true, + "memberOf" : "Roo.util.Observable", + "isStatic" : true, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "o", + "type" : "Observable", + "desc" : "The Observable to capture", + "isOptional" : false + }, + { + "name" : "fn", + "type" : "Function", + "desc" : "The function to call", + "isOptional" : false + }, + { + "name" : "scope", + "type" : "Object", + "desc" : "(optional) The scope (this object) for the fn", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "addListener", + "type" : "function", + "desc" : "Appends an event handler to this component", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "eventName", + "type" : "String", + "desc" : "The type of event to listen for", + "isOptional" : false + }, + { + "name" : "handler", + "type" : "Function", + "desc" : "The method the event invokes", + "isOptional" : false + }, + { + "name" : "scope", + "type" : "Object", + "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.", + "isOptional" : false + }, + { + "name" : "options", + "type" : "Object", + "desc" : "(optional) An object containing handler configuration\nproperties. This may contain any of the following properties:
\n

\nCombining Options
\nUsing the options argument, it is possible to combine different types of listeners:
\n
\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t

\n\t\tel.on('click', this.onClick, this, {\n \t\t\tsingle: true,\n    \t\tdelay: 100,\n    \t\tforumId: 4\n\t\t});\n\t\t
\n

\nAttaching multiple handlers in 1 call
\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n

\n\t\tel.on({\n\t\t\t'click': {\n        \t\tfn: this.onClick,\n        \t\tscope: this,\n        \t\tdelay: 100\n    \t\t}, \n    \t\t'mouseover': {\n        \t\tfn: this.onMouseOver,\n        \t\tscope: this\n    \t\t},\n    \t\t'mouseout': {\n        \t\tfn: this.onMouseOut,\n        \t\tscope: this\n    \t\t}\n\t\t});\n\t\t
\n

\nOr a shorthand syntax which passes the same scope object to all handlers:\n \t

\n\t\tel.on({\n\t\t\t'click': this.onClick,\n    \t\t'mouseover': this.onMouseOver,\n    \t\t'mouseout': this.onMouseOut,\n    \t\tscope: this\n\t\t});\n\t\t
", + "isOptional" : false + } + ], + "returns" : [] + } + ], + "events" : [ + { + "name" : "crop", + "type" : "function", + "desc" : "Fire after initEvent", + "sig" : "function (_self, data)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "data", + "type" : "String", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "trash", + "type" : "function", + "desc" : "Fire when trash image", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "download", + "type" : "function", + "desc" : "Fire when download the image", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "resize", + "type" : "function", + "desc" : "Fire when resize", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "rotate", + "type" : "function", + "desc" : "Fire when rotate the image", + "sig" : "function (_self, pos)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "pos", + "type" : "String", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforeloadcanvas", + "type" : "function", + "desc" : "Fire before load the canvas", + "sig" : "function (_self, src)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "src", + "type" : "String", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "footerbuttonclick", + "type" : "function", + "desc" : "Fire when footerbuttonclick", + "sig" : "function (_self, type)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "type", + "type" : "String", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforeselectfile", + "type" : "function", + "desc" : "Fire before select file", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "inspect", + "type" : "function", + "desc" : "Fire when inspect the file", + "sig" : "function (_self, file)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "file", + "type" : "Object", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "initial", + "type" : "function", + "desc" : "Fire after initEvent", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "upload", + "type" : "function", + "desc" : "Fire when xhr upload the file", + "sig" : "function (_self, data)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "data", + "type" : "Object", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "loadcanvas", + "type" : "function", + "desc" : "Fire after load the canvas", + "sig" : "function (, imgEl)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "imgEl", + "type" : "Object", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "prepare", + "type" : "function", + "desc" : "Fire when preparing the file data", + "sig" : "function (_self, file)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "file", + "type" : "Object", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "arrange", + "type" : "function", + "desc" : "Fire when arrange the file data", + "sig" : "function (_self, formData)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "formData", + "type" : "Object", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "exception", + "type" : "function", + "desc" : "Fire when get exception", + "sig" : "function (_self, xhr)\n{\n\n}", + "memberOf" : "", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.dialog.UploadCropbox", + "desc" : "", + "isOptional" : false + }, + { + "name" : "xhr", + "type" : "XMLHttpRequest", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "move", + "type" : "function", + "desc" : "Fires after the component is moved.", + "sig" : "function (_self, x, y)\n{\n\n}", + "memberOf" : "Roo.BoxComponent", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + }, + { + "name" : "x", + "type" : "Number", + "desc" : "The new x position", + "isOptional" : false + }, + { + "name" : "y", + "type" : "Number", + "desc" : "The new y position", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforerender", + "type" : "function", + "desc" : "Fires before the component is rendered. Return false to stop the render.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Fires after the component is disabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "render", + "type" : "function", + "desc" : "Fires after the component is rendered.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Fires after the component is destroyed.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Fires after the component is hidden.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforehide", + "type" : "function", + "desc" : "Fires before the component is hidden. Return false to stop the hide.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "show", + "type" : "function", + "desc" : "Fires after the component is shown.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforeshow", + "type" : "function", + "desc" : "Fires before the component is shown. Return false to stop the show.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Fires after the component is enabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + }, + { + "name" : "beforedestroy", + "type" : "function", + "desc" : "Fires before the component is destroyed. Return false to stop the destroy.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [ + { + "name" : "this", + "type" : "Roo.Component", + "desc" : "", + "isOptional" : false + } + ], + "returns" : [] + } + ] +} \ No newline at end of file diff --git a/docs/symbols/Roo.dialog.json b/docs/symbols/Roo.dialog.json new file mode 100644 index 0000000000..4b9a869054 --- /dev/null +++ b/docs/symbols/Roo.dialog.json @@ -0,0 +1,25 @@ +{ + "name" : "Roo.dialog", + "augments" : [], + "childClasses" : { }, + "tree_children" : [], + "tree_parent" : [], + "desc" : "", + "isSingleton" : false, + "isStatic" : false, + "isBuiltin" : false, + "isAbstract" : false, + "isBuilderTop" : false, + "memberOf" : "Roo.dialog", + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "params" : [], + "returns" : [], + "throws" : "", + "requires" : "", + "config" : [], + "methods" : [], + "events" : [] +} \ No newline at end of file