From ca77cc002e9b5bb30a1d292bce026549f115111d Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 5 Jun 2021 21:29:20 +0800 Subject: [PATCH] bugfix --- src/core/wrapper/layout/layout.tape.js | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/core/wrapper/layout/layout.tape.js b/src/core/wrapper/layout/layout.tape.js index ffc76f1f1..dde50fbeb 100644 --- a/src/core/wrapper/layout/layout.tape.js +++ b/src/core/wrapper/layout/layout.tape.js @@ -7,6 +7,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.HTapeLayout.superclass.props.apply(this, arguments), { baseCls: "bi-h-tape", + verticalAlign: BI.VerticalAlign.Top, hgap: 0, vgap: 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, 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 = {}; @@ -110,6 +121,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, { props: function () { return BI.extend(BI.VTapeLayout.superclass.props.apply(this, arguments), { baseCls: "bi-v-tape-layout", + horizontalAlign: BI.HorizontalAlign.Left, hgap: 0, vgap: 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, 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 = {}; @@ -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; } 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 { w.element.css({ bottom: (bottom[i] + (item.vgap || 0) + (item.bgap || 0) + o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,