Roo/bootstrap/LayoutMasonry.js
[roojs1] / Roo / bootstrap / LayoutMasonry.js
index 578c13b..0d61967 100644 (file)
@@ -149,8 +149,10 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component,  {
     
     initial : function()
     {
-        this.currentSize = this.el.getBox(true);
+        this.selectedBrick = [];
         
+        this.currentSize = this.el.getBox(true);
+        alert(this.currentSize);
         Roo.EventManager.onWindowResize(this.resize, this); 
 
         if(!this.isAutoInitial){
@@ -201,7 +203,6 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component,  {
     
     _resetLayout : function()
     {
-        Roo.log('run?????????');
         if(this.isHorizontal){
             this.horizontalMeasureColumns();
             return;
@@ -240,7 +241,7 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component,  {
         
         this.colWidth = boxWidth + avail - this.padWidth;
         
-        this.unitWidth = Math.floor((this.colWidth - (this.gutter * 2)) / 3);
+        this.unitWidth = Math.round((this.colWidth - (this.gutter * 2)) / 3);
         this.unitHeight = this.boxHeight > 0 ? this.boxHeight  : this.unitWidth;
     },
     
@@ -1248,7 +1249,6 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component,  {
         for (var i = 0; i<this.bricks.length; i++) {
             if (this.bricks[i].id == brick_id) {
                 this.bricks.splice(i,1);
-                this.selectedBrick=[];
                 this.el.dom.removeChild(Roo.get(brick_id).dom);
                 this.initial();
             }
@@ -1264,7 +1264,7 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component,  {
         var cn = new Roo.bootstrap.MasonryBrick(cfg);
         //this.register(cn);
         cn.parentId = this.id;
-        cn.onRender(this.el, null);
+        cn.render(this.el);
         return cn;
     },