From 3d572b6aa572a5f44f2f2241363375862c7dc46b Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 11 Feb 2021 10:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout/adapt/adapt.table.js | 2 +- .../wrapper/layout/adapt/float.horizontal.js | 70 ------------------- src/core/wrapper/layout/layout.table.js | 14 ++-- src/core/wrapper/layout/layout.td.js | 4 +- 4 files changed, 9 insertions(+), 81 deletions(-) delete mode 100644 src/core/wrapper/layout/adapt/float.horizontal.js diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index 106b8f403..9696303eb 100644 --- a/src/core/wrapper/layout/adapt/adapt.table.js +++ b/src/core/wrapper/layout/adapt/adapt.table.js @@ -35,7 +35,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit); + var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; if (!this.hasWidget(this._getChildName(i))) { var w = BI._lazyCreateWidget(item); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); diff --git a/src/core/wrapper/layout/adapt/float.horizontal.js b/src/core/wrapper/layout/adapt/float.horizontal.js deleted file mode 100644 index 84f2cbaa0..000000000 --- a/src/core/wrapper/layout/adapt/float.horizontal.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 浮动的水平居中布局 - */ -BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-horizontal-adapt-layout", - items: [], - hgap: 0, - vgap: 0, - tgap: 0, - bgap: 0, - lgap: 0, - rgap: 0 - }); - }, - render: function () { - BI.FloatHorizontalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("float_horizontal_adapt布局不需要resize"); - }, - - mounted: function () { - var self = this; - var width = this.left.element.width(), - height = this.left.element.height(); - this.left.element.width(width).height(height).css("float", "none"); - BI.remove(this._children, function (i, wi) { - if (wi === self.container) { - delete self._children[i]; - } - }); - BI._lazyCreateWidget({ - type: "bi.horizontal_auto", - element: this, - items: [this.left] - }); - }, - - _addElement: function (i, item) { - var self = this, o = this.options; - this.left = BI._lazyCreateWidget({ - type: "bi.vertical", - items: [item], - hgap: o.hgap, - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap - }); - - this.container = BI._lazyCreateWidget({ - type: "bi.left", - element: this, - items: [this.left] - }); - - return this.left; - }, - - populate: function (items) { - BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout); diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js index 69757277a..93af1f51a 100644 --- a/src/core/wrapper/layout/layout.table.js +++ b/src/core/wrapper/layout/layout.table.js @@ -79,8 +79,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - left: o.columnSize[i] <= 1 ? left * 100 + "%" : left / BI.pixRatio + BI.pixUnit, - width: o.columnSize[i] <= 1 ? o.columnSize[i] * 100 + "%" : o.columnSize[i] / BI.pixRatio + BI.pixUnit + left: o.columnSize[i] <= 1 ? left * 100 + "%" : left, + width: o.columnSize[i] <= 1 ? o.columnSize[i] * 100 + "%" : o.columnSize[i] }, arr[i])); left += o.columnSize[i] + (o.columnSize[i] < 1 ? 0 : o.hgap); } else { @@ -93,8 +93,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - right: o.columnSize[j] <= 1 ? right * 100 + "%" : right / BI.pixRatio + BI.pixUnit, - width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] / BI.pixRatio + BI.pixUnit + right: o.columnSize[j] <= 1 ? right * 100 + "%" : right, + width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] }, arr[j])); right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap); } else { @@ -106,13 +106,13 @@ BI.TableLayout = BI.inherit(BI.Layout, { abs.push(BI.extend({ top: 0, bottom: 0, - left: left <= 1 ? left * 100 + "%" : left / BI.pixRatio + BI.pixUnit, - right: right <= 1 ? right * 100 + "%" : right / BI.pixRatio + BI.pixUnit + left: left <= 1 ? left * 100 + "%" : left, + right: right <= 1 ? right * 100 + "%" : right }, arr[i])); } var w = BI._lazyCreateWidget({ type: "bi.absolute", - height: (BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize) / BI.pixRatio + BI.pixUnit, + height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, items: abs }); if (this.rows > 0) { diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index 05acf721f..1448d3f8c 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -100,9 +100,7 @@ BI.TdLayout = BI.inherit(BI.Layout, { first(w, this.rows++, i); var td = BI._lazyCreateWidget({ type: "bi.default", - attributes: { - width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i] / BI.pixRatio + BI.pixUnit - }, + width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i], tagName: "td", items: [w] });