guy 3 years ago
parent
commit
193db55dbd
  1. 19
      src/core/wrapper/layout/layout.inline.js

19
src/core/wrapper/layout/layout.inline.js

@ -33,7 +33,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
this.populate(o.items);
},
_addElement: function (i, item, length) {
_addElement: function (i, item) {
var o = this.options;
var w = BI.InlineLayout.superclass._addElement.apply(this, arguments);
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width;
@ -50,16 +50,16 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
"vertical-align": o.verticalAlign
});
w.element.addClass("i-item");
if (o.columnSize[i] === "fill" || o.columnSize[i] === "") {
if (columnSize === "fill" || columnSize === "") {
var left = o.hgap + (item.lgap || 0) + (item.hgap || 0),
right = o.hgap + (item.rgap || 0) + (item.hgap || 0);
for (var k = 0; k < i; k++) {
left += o.hgap + o.lgap + o.rgap + o.columnSize[k];
left += o.hgap + o.lgap + o.rgap + (o.columnSize[k] || o.items[k].width);
}
for (var k = i + 1; k < o.columnSize.length; k++) {
right += o.hgap + o.lgap + o.rgap + o.columnSize[k];
right += o.hgap + o.lgap + o.rgap + (o.columnSize[k] || o.items[k].width);
}
if (o.columnSize[i] === "fill") {
if (columnSize === "fill") {
w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")");
}
if (o.horizontalAlign === BI.HorizontalAlign.Stretch || !(o.scrollable === true || o.scrollx === true)) {
@ -102,15 +102,6 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineLayout.superclass.populate.apply(this, arguments);
this._mount();

Loading…
Cancel
Save