Browse Source

Pull request #1954: 无JIRA任务 tape布局也支持下居中

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'ca77cc002e9b5bb30a1d292bce026549f115111d':
  bugfix
es6
guy 3 years ago
parent
commit
bb9522d9e7
  1. 27
      src/core/wrapper/layout/layout.tape.js

27
src/core/wrapper/layout/layout.tape.js

@ -7,6 +7,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
props: function () { props: function () {
return BI.extend(BI.HTapeLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.HTapeLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-h-tape", baseCls: "bi-h-tape",
verticalAlign: BI.VerticalAlign.Top,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -44,6 +45,16 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
top: ((item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit, top: ((item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
bottom: ((item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit bottom: ((item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit
}); });
if (o.verticalAlign === BI.VerticalAlign.Middle) {
w.element.css({
marginTop: "auto",
marginBottom: "auto"
});
} else if (o.verticalAlign === BI.VerticalAlign.Bottom) {
w.element.css({
marginTop: "auto"
});
}
}); });
var left = {}, right = {}; var left = {}, right = {};
@ -110,6 +121,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
props: function () { props: function () {
return BI.extend(BI.VTapeLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.VTapeLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-v-tape-layout", baseCls: "bi-v-tape-layout",
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -148,6 +160,16 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
left: ((item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, left: ((item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
right: +((item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit right: +((item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
}); });
if (o.horizontalAlign === BI.HorizontalAlign.Center) {
w.element.css({
marginLeft: "auto",
marginRight: "auto"
});
} else if (o.horizontalAlign === BI.HorizontalAlign.Right) {
w.element.css({
marginLeft: "auto"
});
}
}); });
var top = {}, bottom = {}; var top = {}, bottom = {};
@ -177,7 +199,10 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom[i] = bottom[i + 1] + items[i + 1].height + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap; bottom[i] = bottom[i + 1] + items[i + 1].height + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
} }
if (item.height < 1 && item.height >= 0) { if (item.height < 1 && item.height >= 0) {
w.element.css({bottom: (bottom[i] * 100).toFixed(1) + "%", height: (item.height * 100).toFixed(1) + "%"}); w.element.css({
bottom: (bottom[i] * 100).toFixed(1) + "%",
height: (item.height * 100).toFixed(1) + "%"
});
} else { } else {
w.element.css({ w.element.css({
bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit, bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,

Loading…
Cancel
Save