X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fbootstrap%2FLayoutMasonry.js;h=281ec2dd4715afea2d11a2f98465e8247b2b89fd;hb=bbcf546f87d4e1f1f5d9c4508331421bb3ddc851;hp=2ac6f7e2a8b6b14e2340dad8431dda771bd00560;hpb=be56baa194c1197ea62941e4aa1f7d5296dca92d;p=roojs1 diff --git a/Roo/bootstrap/LayoutMasonry.js b/Roo/bootstrap/LayoutMasonry.js index 2ac6f7e2a8..281ec2dd47 100644 --- a/Roo/bootstrap/LayoutMasonry.js +++ b/Roo/bootstrap/LayoutMasonry.js @@ -21,10 +21,13 @@ */ Roo.bootstrap.LayoutMasonry = function(config){ + Roo.bootstrap.LayoutMasonry.superclass.constructor.call(this, config); this.bricks = []; + Roo.bootstrap.LayoutMasonry.register(this); + this.addEvents({ // raw events /** @@ -100,10 +103,14 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component, { /** * @cfg {Number} alternativePadWidth padding below box.. */ - alternativePadWidth : 50, + alternativePadWidth : 50, + + selectedBrick : [], getAutoCreate : function(){ + var cfg = Roo.apply({}, Roo.bootstrap.LayoutMasonry.superclass.getAutoCreate.call(this)); + var cfg = { tag: this.tag, cls: 'blog-masonary-wrapper ' + this.cls, @@ -142,6 +149,8 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component, { initial : function() { + this.selectedBrick = []; + this.currentSize = this.el.getBox(true); Roo.EventManager.onWindowResize(this.resize, this); @@ -232,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; }, @@ -654,8 +663,11 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component, { b.el.setWidth(width); b.el.setHeight(height); + + b.el.select('iframe',true).set('width', width); + b.el.select('iframe',true).set(height); // iframe? - b.el.select('iframe',true).setSize(width,height); +// b.el.select('iframe',true).setSize(width,height); }, this); @@ -1227,22 +1239,43 @@ Roo.extend(Roo.bootstrap.LayoutMasonry, Roo.bootstrap.Component, { }, + /** + * remove a Masonry Brick + * @param {Roo.bootstrap.MasonryBrick} the masonry brick to remove + */ + removeBrick : function(brick_id) + { + if (!brick_id) { + return; + } + + for (var i = 0; i