*/
Roo.bootstrap.LayoutMasonry = function(config){
+
Roo.bootstrap.LayoutMasonry.superclass.constructor.call(this, config);
this.bricks = [];
+ Roo.bootstrap.LayoutMasonry.register(this);
+
this.addEvents({
// raw events
/**
getAutoCreate : function(){
+ var cfg = Roo.apply({}, Roo.bootstrap.LayoutMasonry.superclass.getAutoCreate.call(this));
+
var cfg = {
tag: this.tag,
cls: 'blog-masonary-wrapper ' + this.cls,
initial : function()
{
+ this.selectedBrick = [];
+
this.currentSize = this.el.getBox(true);
Roo.EventManager.onWindowResize(this.resize, this);
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;
},
},
+ /**
+ * 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<this.bricks.length; i++) {
+ if (this.bricks[i].id == brick_id) {
+ this.bricks.splice(i,1);
+ this.el.dom.removeChild(Roo.get(brick_id).dom);
+ this.initial();
+ }
+ }
+ },
+
/**
* adds a Masonry Brick
* @param {Roo.bootstrap.MasonryBrick} the masonry brick to add
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;
},
getSelected : function()
{
- for (var i=0; i<this.bricks.length; i++) {
- Roo.log(this.bricks[i]);
+ if (!this.selectedBrick) {
+ return false;
}
+
+ return this.selectedBrick;
}
});
groups: {},
/**
- * register a Layout of Masonry
- * @param {Roo.bootstrap.LayoutMasonry} the layout to add
+ * register a Masonry Layout
+ * @param {Roo.bootstrap.LayoutMasonry} the masonry layout to add
*/
register : function(layout)
this.groups[layout.id] = layout;
},
/**
- * fetch a Navigation Group based on the navigation ID
- * @param {string} the navgroup to add
- * @returns {Roo.bootstrap.NavGroup} the navgroup
+ * fetch a Masonry Layout based on the masonry layout ID
+ * @param {string} the masonry layout to add
+ * @returns {Roo.bootstrap.LayoutMasonry} the masonry layout
*/
get: function(layout_id) {
if (typeof(this.groups[layout_id]) == 'undefined') {
return false;
- //this.register(new Roo.bootstrap.NavGroup({ navId : navId }));
}
return this.groups[layout_id] ;
}