Browse Source

stretch能够根据是否有滚动条能够动态选择,而不需要主动选择

es6
guy 4 years ago
parent
commit
9beb6aa2a0
  1. 3
      src/core/wrapper/layout/adapt/float.horizontal.js
  2. 3
      src/core/wrapper/layout/layout.horizontal.js
  3. 2
      src/core/wrapper/layout/layout.inline.js

3
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);

3
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);

2
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) + ")");
}
}

Loading…
Cancel
Save