bodyEl: false, // card-body
headerContainerEl : false, //
headerEl : false,
+ header_imageEl : false,
layoutCls : function()
{
},
getCardImageTop : function()
{
- var ret = this.el.select('.card-img-top',true).first();
+ var ret = this.header_imageEl;
if (ret.hasClass('d-none')) {
ret.removeClass('d-none');
}
this.el.addClass('roo-card-rotated');
this.fireEvent('rotate', this, true);
}
+ this.header_imageEl = this.el.select('.card-img-top',true).first();
+ this.header_imageEl.on('load', this.onHeaderImageLoad, this);
},
getDragData : function(e)
if (this.headerContainerEl) {
this.headerContainerEl.dom.innerHTML = html;
}
+ },
+ onHeaderImageLoad : function(he)
+ {
+ if (!this.header_image_fit_square) {
+ return;
+ }
+
+ var hw = he.dom.naturalHeight / he.dom.naturalWidth;
+ // wide image = < 0
+ // tall image = > 1
+ //var w = he.dom.naturalWidth;
+ var ww = he.dom.width;
+ if (hw > 1) {
+ he.setSize( ww * (1/hw), ww);
+ }
+
}