Browse Source

整理代码

es6
guy 3 years ago
parent
commit
5461ce76ba
  1. 136
      src/core/wrapper/layout/float/float.horizontal.js

136
src/core/wrapper/layout/float/float.horizontal.js

@ -3,72 +3,82 @@
*/ */
BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
props: function () { props: function () {
return BI.extend(BI.InlineHorizontalAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.InlineHorizontalAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-h-fl", baseCls: "bi-h-fl",
horizontalAlign: BI.HorizontalAlign.Center, horizontalAlign: BI.HorizontalAlign.Center,
verticalAlign: BI.VerticalAlign.Top, verticalAlign: BI.VerticalAlign.Top,
rowSize: [], rowSize: [],
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0 bgap: 0
}); });
}, },
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
if (o.verticalAlign === BI.VerticalAlign.Top){ if (o.verticalAlign === BI.VerticalAlign.Top) {
return { return {
type: "bi.vertical", type: "bi.vertical",
ref: function (_ref) { ref: function (_ref) {
self.layout = _ref; self.layout = _ref;
}, },
items: this._formatItems(o.items), items: this._formatItems(o.items),
vgap: o.vgap, vgap: o.vgap,
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap bgap: o.bgap,
}; scrollx: o.scrollx,
} scrolly: o.scrolly,
return { scrollable: o.scrollable
type: "bi.inline", };
items: [{ }
type: "bi.vertical", return {
ref: function (_ref) { type: "bi.inline",
self.layout = _ref; items: [{
}, el: {
items: this._formatItems(o.items), type: "bi.vertical",
vgap: o.vgap, ref: function (_ref) {
tgap: o.tgap, self.layout = _ref;
bgap: o.bgap },
}], items: this._formatItems(o.items),
horizontalAlign: o.horizontalAlign, vgap: o.vgap,
verticalAlign: o.verticalAlign tgap: o.tgap,
}; bgap: o.bgap
}, }
}],
horizontalAlign: o.horizontalAlign,
verticalAlign: o.verticalAlign,
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
};
},
_formatItems: function (items) { _formatItems: function (items) {
var o = this.options; var o = this.options;
return BI.map(items, function (i, item) { return BI.map(items, function (i, item) {
return { return {
type: "bi.inline_horizontal_adapt", el: {
horizontalAlign: o.horizontalAlign, type: "bi.inline_horizontal_adapt",
items: [item], horizontalAlign: o.horizontalAlign,
hgap: o.hgap, items: [item],
lgap: o.lgap, hgap: o.hgap,
rgap: o.rgap lgap: o.lgap,
} rgap: o.rgap
}); }
}, };
});
},
resize: function () { resize: function () {
this.layout.stroke(this._formatItems(this.options.items)); this.layout.stroke(this._formatItems(this.options.items));
}, },
populate: function (items) { populate: function (items) {
this.layout.populate(this._formatItems(items)); this.layout.populate(this._formatItems(items));
} }
}); });
BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout); BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);

Loading…
Cancel
Save