Browse Source

bugfix

master
git 3 years ago
parent
commit
071ee7c08f
  1. 11
      src/core/wrapper/layout/flex/flex.horizontal.js
  2. 13
      src/core/wrapper/layout/flex/flex.vertical.js
  3. 11
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  4. 11
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  5. 84
      src/core/wrapper/layout/layout.tape.js

11
src/core/wrapper/layout/flex/flex.horizontal.js

@ -37,11 +37,12 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments);
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
w.element.css({ w.element.css({
position: "relative" position: "relative"
}); });
if (o.columnSize[i] !== "auto") { if (columnSize !== "auto") {
if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { if (columnSize === "fill" || columnSize === "") {
if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) {
if (o.scrollable === true || o.scrollx === true) { if (o.scrollable === true || o.scrollx === true) {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
@ -51,10 +52,10 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
} }
} }
if (o.columnSize[i] > 0) { if (columnSize > 0) {
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
} }
if (o.columnSize[i] === "fill") { if (columnSize === "fill") {
w.element.addClass("f-f"); w.element.addClass("f-f");
} }
w.element.addClass("c-e"); w.element.addClass("c-e");

13
src/core/wrapper/layout/flex/flex.vertical.js

@ -34,13 +34,14 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments);
var o = this.options; var o = this.options;
var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments);
var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height;
w.element.css({ w.element.css({
position: "relative" position: "relative"
}); });
if (o.rowSize[i] !== "auto") { if (rowSize !== "auto") {
if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { if (rowSize === "fill" || rowSize === "") {
if (o.verticalAlign !== BI.VerticalAlign.Stretch) { if (o.verticalAlign !== BI.VerticalAlign.Stretch) {
if (o.scrollable === true || o.scrolly === true) { if (o.scrollable === true || o.scrolly === true) {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
@ -50,10 +51,10 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
} }
} }
if (o.rowSize[i] > 0) { if (rowSize > 0) {
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit));
} }
if (o.rowSize[i] === "fill") { if (rowSize === "fill") {
w.element.addClass("f-f"); w.element.addClass("f-f");
} }
w.element.addClass("c-e"); w.element.addClass("c-e");

11
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -33,11 +33,12 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments);
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
w.element.css({ w.element.css({
position: "relative" position: "relative"
}); });
if (o.columnSize[i] !== "auto") { if (columnSize !== "auto") {
if (o.columnSize[i] === "fill" || o.columnSize[i] === "") { if (columnSize === "fill" || columnSize === "") {
if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) { if (o.horizontalAlign !== BI.HorizontalAlign.Stretch) {
if (o.scrollable === true || o.scrollx === true) { if (o.scrollable === true || o.scrollx === true) {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
@ -47,10 +48,10 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
} }
} }
if (o.columnSize[i] > 0) { if (columnSize > 0) {
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit))); w.element.width(columnSize <= 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
} }
if (o.columnSize[i] === "fill") { if (columnSize === "fill") {
w.element.addClass("f-f"); w.element.addClass("f-f");
this.element.addClass("f-f"); this.element.addClass("f-f");
} }

11
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

@ -33,11 +33,12 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments);
var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.width;
w.element.css({ w.element.css({
position: "relative" position: "relative"
}); });
if (o.rowSize[i] !== "auto") { if (rowSize !== "auto") {
if (o.rowSize[i] === "fill" || o.rowSize[i] === "") { if (rowSize === "fill" || rowSize === "") {
if (o.verticalAlign !== BI.VerticalAlign.Stretch) { if (o.verticalAlign !== BI.VerticalAlign.Stretch) {
if (o.scrollable === true || o.scrolly === true) { if (o.scrollable === true || o.scrolly === true) {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
@ -47,10 +48,10 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
w.element.addClass("f-s-n"); w.element.addClass("f-s-n");
} }
} }
if (o.rowSize[i] > 0) { if (rowSize > 0) {
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit))); w.element.height(rowSize <= 1 ? ((rowSize * 100).toFixed(1) + "%") : (rowSize / BI.pixRatio + BI.pixUnit));
} }
if (o.rowSize[i] === "fill") { if (rowSize === "fill") {
w.element.addClass("f-f"); w.element.addClass("f-f");
this.element.addClass("f-f"); this.element.addClass("f-f");
} }

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

@ -64,59 +64,45 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
BI.any(items, function (i, item) { BI.any(items, function (i, item) {
var w = self.getWidgetByName(self._getChildName(i)); var w = self.getWidgetByName(self._getChildName(i));
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (BI.isNull(left[i])) { if (BI.isNull(left[i])) {
left[i] = left[i - 1] + (o.columnSize[i - 1] || items[i - 1].width) + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap; var preColumnSize = o.columnSize.length > 0 ? o.columnSize[i - 1] : items[i - 1].width;
left[i] = left[i - 1] + preColumnSize + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
} }
if (o.columnSize[i] < 1 && o.columnSize[i] > 0) { if (columnSize < 1 && columnSize > 0) {
w.element.css({ w.element.css({
left: (left[i] * 100).toFixed(1) + "%", left: (left[i] * 100).toFixed(1) + "%",
width: (o.columnSize[i] * 100).toFixed(1) + "%" width: (columnSize * 100).toFixed(1) + "%"
});
} else if (item.width < 1 && item.width >= 0) {
w.element.css({
left: (left[i] * 100).toFixed(1) + "%",
width: (item.width * 100).toFixed(1) + "%"
}); });
} else { } else {
w.element.css({ w.element.css({
left: (left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, left: (left[i] + (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit : width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : ""
BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (o.columnSize[i] === "" || o.columnSize[i] === "fill") { if (columnSize === "" || columnSize === "fill") {
return true;
}
if (o.columnSize.length <= 0 && !BI.isNumber(item.width)) {
return true; return true;
} }
}); });
BI.backAny(items, function (i, item) { BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self._getChildName(i)); var w = self.getWidgetByName(self._getChildName(i));
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (BI.isNull(right[i])) { if (BI.isNull(right[i])) {
right[i] = right[i + 1] + (o.columnSize[i + 1] || items[i + 1].width) + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap; var nextColumnSize = o.columnSize.length > 0 ? o.columnSize[i + 1] : items[i + 1].width;
right[i] = right[i + 1] + nextColumnSize + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
} }
if (o.columnSize[i] < 1 && o.columnSize[i] > 0) { if (columnSize < 1 && columnSize > 0) {
w.element.css({ w.element.css({
right: (right[i] * 100).toFixed(1) + "%", right: (right[i] * 100).toFixed(1) + "%",
width: (o.columnSize[i] * 100).toFixed(1) + "%" width: (columnSize * 100).toFixed(1) + "%"
});
} else if (item.width < 1 && item.width >= 0) {
w.element.css({
right: (right[i] * 100).toFixed(1) + "%",
width: (item.width * 100).toFixed(1) + "%"
}); });
} else { } else {
w.element.css({ w.element.css({
right: (right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit, right: (right[i] + (item.rgap || 0) + (item.hgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit : width: BI.isNumber(columnSize) ? columnSize / BI.pixRatio + BI.pixUnit : ""
BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (o.columnSize[i] === "" || o.columnSize[i] === "fill") { if (columnSize === "" || columnSize === "fill") {
return true;
}
if (o.columnSize.length <= 0 && !BI.isNumber(item.width)) {
return true; return true;
} }
}); });
@ -204,59 +190,45 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
BI.any(items, function (i, item) { BI.any(items, function (i, item) {
var w = self.getWidgetByName(self._getChildName(i)); var w = self.getWidgetByName(self._getChildName(i));
var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height;
if (BI.isNull(top[i])) { if (BI.isNull(top[i])) {
top[i] = top[i - 1] + (o.rowSize[i - 1] || items[i - 1].height) + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap; var preRowSize = o.rowSize.length > 0 ? o.rowSize[i - 1] : items[i - 1].height;
top[i] = top[i - 1] + preRowSize + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
} }
if (o.rowSize[i] < 1 && o.rowSize[i] > 0) { if (rowSize < 1 && rowSize > 0) {
w.element.css({ w.element.css({
top: (top[i] * 100).toFixed(1) + "%", top: (top[i] * 100).toFixed(1) + "%",
height: (o.rowSize[i] * 100).toFixed(1) + "%" height: (rowSize * 100).toFixed(1) + "%"
});
} else if (item.height < 1 && item.height >= 0) {
w.element.css({
top: (top[i] * 100).toFixed(1) + "%",
height: (item.height * 100).toFixed(1) + "%"
}); });
} else { } else {
w.element.css({ w.element.css({
top: (top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit, top: (top[i] + (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit : height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : ""
BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (o.rowSize[i] === "" || o.rowSize[i] === "fill") { if (rowSize === "" || rowSize === "fill") {
return true;
}
if (o.rowSize.length <= 0 && !BI.isNumber(item.height)) {
return true; return true;
} }
}); });
BI.backAny(items, function (i, item) { BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self._getChildName(i)); var w = self.getWidgetByName(self._getChildName(i));
var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height;
if (BI.isNull(bottom[i])) { if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] || items[i + 1].height) + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap; var nextRowSize = o.rowSize.length > 0 ? o.rowSize[i + 1] : items[i + 1].height;
bottom[i] = bottom[i + 1] + nextRowSize + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
} }
if (o.rowSize[i] < 1 && o.rowSize[i] > 0) { if (rowSize < 1 && rowSize > 0) {
w.element.css({ w.element.css({
bottom: (bottom[i] * 100).toFixed(1) + "%", bottom: (bottom[i] * 100).toFixed(1) + "%",
height: (o.rowSize[i] * 100).toFixed(1) + "%" height: (rowSize * 100).toFixed(1) + "%"
});
} else if (item.height < 1 && item.height >= 0) {
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,
height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit : height: BI.isNumber(rowSize) ? rowSize / BI.pixRatio + BI.pixUnit : ""
BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (o.rowSize[i] === "" || o.rowSize[i] === "fill") { if (rowSize === "" || rowSize === "fill") {
return true;
}
if (o.rowSize.length <= 0 && !BI.isNumber(item.height)) {
return true; return true;
} }
}); });

Loading…
Cancel
Save