image editing dialog
[roojs1] / examples / dialog / test-2.js
index 4b1f493..b8efe82 100644 (file)
@@ -34,38 +34,54 @@ var uploadCropbox = {
                         {
                             xtype : 'UploadCropbox',
                             xns : Roo.dialog,
-                            minWidth : 60,
-                            minHeight: 40,
+                            minWidth : 720,
+                            minHeight: 480,
+                            buttons: [],
                             listeners : {
-                                arrange : function (_self, formData)
-                                {
-                                    console.log("ARRANGE");
-                                    console.log(formData);
-                                },
-                                crop : function (_self, data)
-                                {
-                                    console.log("CROP");
-                                    console.log(data);
-                                },
-                                resize : function (_self)
-                                {
-                                    console.log("RESIZE");
-                                },
-                                rotate : function (_self)
-                                {
-                                    console.log("ROTATE");
-                                },
                                 render : function (_self)
                                 {
-                                    console.log("RENDER");
-                                    console.log(_self);
                                     _this.cropbox = _self;
+                                },
+                                loadcanvas : function (_self, imageEl)
+                                {
+                                    // if(imageEl.OriginWidth < 720) {
+                                    //     Roo.Msg.show({
+                                    //         title: 'Error',
+                                    //         msg: "Image width should be at least 720",
+                                    //         buttons: {ok : true},
+                                    //         fn: function(res) {
+                                    //             _this.cropbox.selectorEl.dom.click();
+                                    //         }
+                                    //     });
+                                    //     return false;
+                                    // }
                                 }
                             }
                         }
                     ]
                 }
             ],
+            buttons : [
+                {
+                    xtype : 'Button',
+                    xns : Roo,
+                    text : 'Save',
+                    listeners : {
+                        click : function () {
+                        }   
+                    }
+                },
+                {
+                    xtype : 'Button',
+                    xns : Roo,
+                    text : 'Cancel',
+                    listeners : {
+                        click : function () {
+                            _this.dialog.hide()
+                        }   
+                    }
+                }
+            ]
         });
     }
 }
@@ -127,7 +143,13 @@ var test = {
                                     listeners : {
                                         click : function () {
                                             uploadCropbox.show();
-                                            console.log(uploadCropbox);
+                                            document.body.onfocus = function(e) {
+                                                document.body.onfocus = null;
+                                                if(!uploadCropbox.cropbox.selectorEl.dom.files.length) {
+                                                    uploadCropbox.dialog.hide();
+                                                }
+                                            }
+                                            uploadCropbox.cropbox.selectorEl.dom.click();
                                         }
                                     }
                                 }