X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsymbols%2Fsrc%2FRoo_bootstrap_MasonryBrick.js.html;h=0e81e7d88276b6195da40a6c71c4d5f1b1c8aab8;hb=c1081f6f4b74fed0a601b8fa1f97a3c6372cb36b;hp=c93f26ec95df74c5701313e08fcf35b6c525afcb;hpb=3ce24a55f7fd794ff1b2b0cc999eba892abe50ad;p=roojs1 diff --git a/docs/symbols/src/Roo_bootstrap_MasonryBrick.js.html b/docs/symbols/src/Roo_bootstrap_MasonryBrick.js.html index c93f26ec95..0e81e7d882 100644 --- a/docs/symbols/src/Roo_bootstrap_MasonryBrick.js.html +++ b/docs/symbols/src/Roo_bootstrap_MasonryBrick.js.html @@ -16,8 +16,11 @@ */ Roo.bootstrap.MasonryBrick = function(config){ + Roo.bootstrap.MasonryBrick.superclass.constructor.call(this, config); + Roo.bootstrap.MasonryBrick.register(this); + this.addEvents({ // raw events /** @@ -57,12 +60,12 @@ */ href : '', /** - * @cfg {String} (xs|sm|md|md-left|md-right|tall|wide) size + * @cfg {String} size (xs|sm|md|md-left|md-right|tall|wide) */ size : 'xs', /** - * @cfg {String} (center|bottom) placetitle + * @cfg {String} placetitle (center|bottom) */ placetitle : '', @@ -76,6 +79,11 @@ */ preventDefault : false, + /** + * @cfg {Boolean} inverse defalut false + */ + maskInverse : false, + getAutoCreate : function() { if(!this.isFitContainer){ @@ -92,7 +100,11 @@ cls += ' masonry-brick-image'; } - if(!this.html.length){ + if(this.maskInverse){ + cls += ' mask-inverse'; + } + + if(!this.html.length && !this.maskInverse && !this.videourl.length){ cls += ' enable-mask'; } @@ -131,6 +143,10 @@ tag: (this.href.length) ? 'a' : 'div', cls: cls, cn: [ + { + tag: 'div', + cls: 'masonry-brick-mask' + }, { tag: 'div', cls: 'masonry-brick-paragraph', @@ -143,7 +159,7 @@ cfg.href = this.href; } - var cn = cfg.cn[0].cn; + var cn = cfg.cn[1].cn; if(this.title.length){ cn.push({ @@ -159,9 +175,10 @@ cls: 'masonry-brick-text', html: this.html }); - } + } + if (!this.title.length && !this.html.length) { - cfg.cn[0].cls += ' hide'; + cfg.cn[1].cls += ' hide'; } if(this.bgimage.length){ @@ -182,15 +199,8 @@ frameborder : 0, allowfullscreen : true }); - - } - cfg.cn.push({ - tag: 'div', - cls: 'masonry-brick-mask' - }); - return cfg; }, @@ -353,7 +363,7 @@ onClick: function(e, el) { var time = this.endTimer - this.startTimer; - + // Roo.log(e.preventDefault()); if(Roo.isTouch){ if(time > 1000){ e.preventDefault(); @@ -366,6 +376,11 @@ } e.preventDefault(); + + if (this.activcClass != '') { + this.selectBrick(); + } + this.fireEvent('click', this); }, @@ -373,7 +388,7 @@ { e.preventDefault(); - if(!this.isFitContainer){ + if(!this.isFitContainer || this.maskInverse || this.videourl.length){ return; } @@ -386,7 +401,7 @@ { e.preventDefault(); - if(!this.isFitContainer){ + if(!this.isFitContainer || this.maskInverse || this.videourl.length){ return; } @@ -454,10 +469,74 @@ this.el.select('.masonry-brick-paragraph', true).first().setOpacity(0, true); window.location.href = this.href; + }, + + //selection on single brick only + selectBrick : function() { + + if (!this.parentId) { + return; + } + + var m = Roo.bootstrap.LayoutMasonry.get(this.parentId); + var index = m.selectedBrick.indexOf(this.id); + + if ( index > -1) { + m.selectedBrick.splice(index,1); + this.el.removeClass(this.activeClass); + return; + } + + for(var i = 0; i < m.selectedBrick.length; i++) { + var b = Roo.bootstrap.MasonryBrick.get(m.selectedBrick[i]); + b.el.removeClass(b.activeClass); + } + + m.selectedBrick = []; + + m.selectedBrick.push(this.id); + this.el.addClass(this.activeClass); + return; } }); - +Roo.apply(Roo.bootstrap.MasonryBrick, { + + //groups: {}, + groups : new Roo.util.MixedCollection(false, function(o) { return o.el.id; }), + /** + * register a Masonry Brick + * @param {Roo.bootstrap.MasonryBrick} the masonry brick to add + */ + + register : function(brick) + { + //this.groups[brick.id] = brick; + this.groups.add(brick.id, brick); + }, + /** + * fetch a masonry brick based on the masonry brick ID + * @param {string} the masonry brick to add + * @returns {Roo.bootstrap.MasonryBrick} the masonry brick + */ + + get: function(brick_id) + { + // if (typeof(this.groups[brick_id]) == 'undefined') { + // return false; + // } + // return this.groups[brick_id] ; + + if(this.groups.key(brick_id)) { + return this.groups.key(brick_id); + } + + return false; + } + + + +}); \ No newline at end of file