try and get ctrl-enter to add a clear all
[roojs1] / Roo / bootstrap / Brick.js
index 70c4ccc..425b22b 100644 (file)
@@ -117,6 +117,8 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
                 cls: 'roo-brick-text',
                 html: this.html
             });
+        } else {
+            cn.cls += ' hide';
         }
         
         if(this.bgimage.length){
@@ -137,23 +139,41 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
             this.el.on('mouseleave', this.leave, this);
         }
         
-        
         Roo.EventManager.onWindowResize(this.resize, this); 
         
+        if(this.bgimage.length){
+            this.imageEl = this.el.select('.roo-brick-image-view', true).first();
+            this.imageEl.on('load', this.onImageLoad, this);
+            return;
+        }
+        
+        this.resize();
+    },
+    
+    onImageLoad : function()
+    {
         this.resize();
     },
     
     resize : function()
     {
         var paragraph = this.el.select('.roo-brick-paragraph', true).first();
-//        paragraph.setHeight(paragraph.getWidth() + paragraph.getPadding('tb'));
-//        paragraph.setHeight(paragraph.getWidth());
-        
-//        if(this.bgimage.length){
-//            var image = this.el.select('.roo-brick-image-view', true).first();
-//            image.setWidth(paragraph.getWidth());
-//            image.setHeight(paragraph.getHeight());
-//        }
+        
+        paragraph.setHeight(paragraph.getWidth() + paragraph.getPadding('tb'));
+        
+        if(this.bgimage.length){
+            var image = this.el.select('.roo-brick-image-view', true).first();
+            
+            image.setWidth(paragraph.getWidth());
+            
+            if(this.square){
+                image.setHeight(paragraph.getWidth());
+            }
+            
+            this.el.setHeight(image.getHeight());
+            paragraph.setHeight(image.getHeight());
+            
+        }
         
     },