From 984e2d075cba4f6c50cb189b425d1f58fd15b2c7 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 7 Apr 2021 20:58:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?stretch=E8=83=BD=E5=A4=9F=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=E8=83=BD?= =?UTF-8?q?=E5=A4=9F=E5=8A=A8=E6=80=81=E9=80=89=E6=8B=A9=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E4=B8=BB=E5=8A=A8=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/flex/flex.horizontal.js | 9 ++++++--- src/core/wrapper/layout/flex/flex.vertical.js | 9 ++++++--- .../layout/flex/wrapper/flex.wrapper.horizontal.js | 9 ++++++--- .../wrapper/layout/flex/wrapper/flex.wrapper.vertical.js | 9 ++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 557aecfe8..2b313f699 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -40,12 +40,15 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { w.element.css({ position: "relative" }); - if (o.columnSize[i] !== "auto") { - if (!(o.horizontalAlign === BI.HorizontalAlign.Stretch && (o.columnSize[i] === "fill" || o.columnSize[i] === ""))) { - w.element.addClass("f-s-n"); + if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { + if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { + if (o.scrollable === true || o.scrollx === true) { + w.element.addClass("f-s-n"); + } } } if (o.columnSize[i] > 0) { + w.element.addClass("f-s-n"); w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.columnSize[i] === "fill") { diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index 52f66df43..836b9c0cf 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -39,12 +39,15 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { w.element.css({ position: "relative" }); - if (o.rowSize[i] !== "auto") { - if (!(o.verticalAlign === BI.VerticalAlign.Stretch && (o.rowSize[i] === "fill" || o.rowSize[i] === ""))) { - w.element.addClass("f-s-n"); + if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { + if (o.verticalAlign !== BI.VerticalAlign.Stretch) { + if (o.scrollable === true || o.scrolly === true) { + w.element.addClass("f-s-n"); + } } } if (o.rowSize[i] > 0) { + w.element.addClass("f-s-n"); w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.rowSize[i] === "fill") { diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js index e9ec1c3e3..1d98c584c 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -36,12 +36,15 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { w.element.css({ position: "relative" }); - if (o.columnSize[i] !== "auto") { - if (!(o.horizontalAlign === BI.HorizontalAlign.Stretch && (o.columnSize[i] === "fill" || o.columnSize[i] === ""))) { - w.element.addClass("f-s-n"); + if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { + if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { + if (o.scrollable === true || o.scrollx === true) { + w.element.addClass("f-s-n"); + } } } if (o.columnSize[i] > 0) { + w.element.addClass("f-s-n"); w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.columnSize[i] === "fill") { diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js index 7f7ce5784..0ee6d00e4 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -36,12 +36,15 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { w.element.css({ position: "relative" }); - if (o.rowSize[i] !== "auto") { - if (!(o.verticalAlign === BI.VerticalAlign.Stretch && (o.rowSize[i] === "fill" && o.rowSize[i] === ""))) { - w.element.addClass("f-s-n"); + if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { + if (o.verticalAlign !== BI.VerticalAlign.Stretch) { + if (o.scrollable === true || o.scrolly === true) { + w.element.addClass("f-s-n"); + } } } if (o.rowSize[i] > 0) { + w.element.addClass("f-s-n"); w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); } if (o.rowSize[i] === "fill") { From 9beb6aa2a02e32d10e6f8a909354b03533516ff3 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 7 Apr 2021 21:06:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?stretch=E8=83=BD=E5=A4=9F=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=E8=83=BD?= =?UTF-8?q?=E5=A4=9F=E5=8A=A8=E6=80=81=E9=80=89=E6=8B=A9=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E4=B8=BB=E5=8A=A8=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/adapt/float.horizontal.js | 3 ++- src/core/wrapper/layout/layout.horizontal.js | 3 ++- src/core/wrapper/layout/layout.inline.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/wrapper/layout/adapt/float.horizontal.js b/src/core/wrapper/layout/adapt/float.horizontal.js index 529855411..5121080d7 100644 --- a/src/core/wrapper/layout/adapt/float.horizontal.js +++ b/src/core/wrapper/layout/adapt/float.horizontal.js @@ -1,5 +1,6 @@ /** * 浮动的水平居中布局 */ -BI.FloatHorizontalLayout = BI.inherit(BI.Layout); +BI.FloatHorizontalLayout = function () { +}; BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout); diff --git a/src/core/wrapper/layout/layout.horizontal.js b/src/core/wrapper/layout/layout.horizontal.js index a2989eff3..525538e92 100644 --- a/src/core/wrapper/layout/layout.horizontal.js +++ b/src/core/wrapper/layout/layout.horizontal.js @@ -3,5 +3,6 @@ * @class BI.HorizontalLayout * @extends BI.Layout */ -BI.HorizontalLayout = BI.inherit(BI.Layout); +BI.HorizontalLayout = function () { +}; BI.shortcut("bi.horizontal", BI.HorizontalLayout); diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 1d2528bcd..182cf8157 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -54,7 +54,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, { if (o.columnSize[i] === "fill") { w.element.css("min-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); } - if (o.horizontalAlign === BI.HorizontalAlign.Stretch) { + if (o.horizontalAlign === BI.HorizontalAlign.Stretch || !(o.scrollable === true || o.scrollx === true)) { w.element.css("max-width", "calc(100% - " + ((left + right) / BI.pixRatio + BI.pixUnit) + ")"); } }