addxtype : function(cfg) {
if(cfg.xtype.match(/^UploadCropbox$/)) {
- cfg.el = this.el.appendChild(document.createElement("div"));
-
this.cropbox = new Roo.factory(cfg);
- this.cropbox.render();
+ this.cropbox.render(this.el);
return this.cropbox;
}
* @param {Roo.dialog.UploadCropbox} this
* @param {Object} formData
*/
- "arrange" : true
+ "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;
onRender : function(ct, position)
{
console.log("On Render");
+ console.log(this);
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) {
{
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();
+ 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.isDocument){
- this.setThumbBoxSize();
}
- this.setThumbBoxPosition();
-
- this.baseScaleLevel();
-
- this.draw();
-
- this.resize();
-
- this.canvasLoaded = true;
-
if(this.loadMask){
this.maskEl.unmask();
}