From 3c12fa62e2d94758b159101527ef3a3aedd94078 Mon Sep 17 00:00:00 2001 From: edward Date: Thu, 28 Dec 2017 16:56:56 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js --- roojs-bootstrap-debug.js | 19 ++++++++++++++++--- roojs-bootstrap.js | 7 ++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 59677f262c..dc00a40096 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -32614,9 +32614,19 @@ 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(); }, @@ -32624,13 +32634,16 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component, { { var paragraph = this.el.select('.roo-brick-paragraph', true).first(); - paragraph.setWidth(paragraph.getWidth() + paragraph.getPadding('lr')); 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()); -// image.setHeight(paragraph.getWidth()); + + if(this.square){ + image.setHeight(paragraph.getWidth()); + } this.el.setHeight(image.getHeight()); paragraph.setHeight(image.getHeight()); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index dfe10dd858..3197a53d5c 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1370,9 +1370,10 @@ Roo.bootstrap.Brick=function(A){Roo.bootstrap.Brick.superclass.constructor.call( if(this.href.length){A+=' roo-brick-link';}if(this.bgimage.length){A+=' roo-brick-image';}if(!this.html.length&&!this.bgimage.length){A+=' roo-brick-center-title';}if(!this.html.length&&this.bgimage.length){A+=' roo-brick-bottom-title';}if(this.cls){A+=' '+this.cls; }var B={tag:(this.href.length)?'a':'div',cls:A,cn:[{tag:'div',cls:'roo-brick-paragraph',cn:[]}]};if(this.href.length){B.href=this.href;}var cn=B.cn[0].cn;if(this.title.length){cn.push({tag:'h4',cls:'roo-brick-title',html:this.title});}if(this.html.length){cn.push({tag:'p',cls:'roo-brick-text',html:this.html} );}else{cn.cls+=' hide';}if(this.bgimage.length){B.cn.push({tag:'img',cls:'roo-brick-image-view',src:this.bgimage});}return B;},initEvents:function(){if(this.title.length||this.html.length){this.el.on('mouseenter',this.enter,this);this.el.on('mouseleave',this.leave,this); -}Roo.EventManager.onWindowResize(this.resize,this);this.resize();},resize:function(){var A=this.el.select('.roo-brick-paragraph',true).first();A.setWidth(A.getWidth()+A.getPadding('lr'));A.setHeight(A.getWidth()+A.getPadding('tb'));if(this.bgimage.length){var B=this.el.select('.roo-brick-image-view',true).first(); -B.setWidth(A.getWidth());this.el.setHeight(B.getHeight());A.setHeight(B.getHeight());}},enter:function(e,el){e.preventDefault();if(this.bgimage.length){this.el.select('.roo-brick-paragraph',true).first().setOpacity(0.9,true);this.el.select('.roo-brick-image-view',true).first().setOpacity(0.1,true); -}},leave:function(e,el){e.preventDefault();if(this.bgimage.length){this.el.select('.roo-brick-paragraph',true).first().setOpacity(0,true);this.el.select('.roo-brick-image-view',true).first().setOpacity(1,true);}}}); +}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 A=this.el.select('.roo-brick-paragraph',true).first(); +A.setHeight(A.getWidth()+A.getPadding('tb'));if(this.bgimage.length){var B=this.el.select('.roo-brick-image-view',true).first();B.setWidth(A.getWidth());if(this.square){B.setHeight(A.getWidth());}this.el.setHeight(B.getHeight());A.setHeight(B.getHeight()); +}},enter:function(e,el){e.preventDefault();if(this.bgimage.length){this.el.select('.roo-brick-paragraph',true).first().setOpacity(0.9,true);this.el.select('.roo-brick-image-view',true).first().setOpacity(0.1,true);}},leave:function(e,el){e.preventDefault(); +if(this.bgimage.length){this.el.select('.roo-brick-paragraph',true).first().setOpacity(0,true);this.el.select('.roo-brick-image-view',true).first().setOpacity(1,true);}}}); // Roo/bootstrap/NumberField.js Roo.bootstrap.NumberField=function(A){Roo.bootstrap.NumberField.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.NumberField,Roo.bootstrap.Input,{allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",castInt:true,initEvents:function(){Roo.bootstrap.NumberField.superclass.initEvents.call(this); var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator;}if(this.allowNegative){A+="-";}this.stripCharsRe=new RegExp('[^'+A+']','gi');var B=function(e){var k=e.getKey();var c=e.getCharCode();if((String.fromCharCode(c)=='.'||String.fromCharCode(c)=='-')&&A.indexOf(String.fromCharCode(c))===-1){e.stopEvent(); -- 2.39.2