Browse Source

Pull request #1972: 无JIRA任务 bugfix

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '690244c4e4f71d5a7f8ff2ccdab1f7ff3548cc89':
  add
  bugfix
  bugfix
es6
guy 3 years ago
parent
commit
ff86ed71b3
  1. 87
      src/core/wrapper/layout/layout.tape.js

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

@ -14,6 +14,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
columnSize: [],
items: [] items: []
}); });
}, },
@ -64,34 +65,58 @@ 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));
if (BI.isNull(left[i])) { if (BI.isNull(left[i])) {
left[i] = left[i - 1] + items[i - 1].width + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap; 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;
} }
if (item.width < 1 && item.width >= 0) { if (o.columnSize[i] < 1 && o.columnSize[i] > 0) {
w.element.css({left: (left[i] * 100).toFixed(1) + "%", width: (item.width * 100).toFixed(1) + "%"}); w.element.css({
left: (left[i] * 100).toFixed(1) + "%",
width: (o.columnSize[i] * 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: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : "" width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit :
BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.width)) { if (o.columnSize[i] === "" || o.columnSize[i] === "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));
if (BI.isNull(right[i])) { if (BI.isNull(right[i])) {
right[i] = right[i + 1] + items[i + 1].width + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap; 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;
} }
if (item.width < 1 && item.width >= 0) { if (o.columnSize[i] < 1 && o.columnSize[i] > 0) {
w.element.css({right: (right[i] * 100).toFixed(1) + "%", width: (item.width * 100).toFixed(1) + "%"}); w.element.css({
right: (right[i] * 100).toFixed(1) + "%",
width: (o.columnSize[i] * 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: BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : "" width: o.columnSize[i] > 0 ? o.columnSize[i] / BI.pixRatio + BI.pixUnit :
BI.isNumber(item.width) ? item.width / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.width)) { if (o.columnSize[i] === "" || o.columnSize[i] === "fill") {
return true;
}
if (o.columnSize.length <= 0 && !BI.isNumber(item.width)) {
return true; return true;
} }
}); });
@ -128,6 +153,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
rgap: 0, rgap: 0,
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
rowSize: [],
items: [] items: []
}); });
}, },
@ -158,7 +184,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
left: ((item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit, 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 right: ((item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit
}); });
if (o.horizontalAlign === BI.HorizontalAlign.Center) { if (o.horizontalAlign === BI.HorizontalAlign.Center) {
w.element.css({ w.element.css({
@ -179,26 +205,43 @@ 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));
if (BI.isNull(top[i])) { if (BI.isNull(top[i])) {
top[i] = top[i - 1] + items[i - 1].height + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap; 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;
} }
if (item.height < 1 && item.height >= 0) { if (o.rowSize[i] < 1 && o.rowSize[i] >=0) {
w.element.css({top: (top[i] * 100).toFixed(1) + "%", height: (item.height * 100).toFixed(1) + "%"}); w.element.css({
top: (top[i] * 100).toFixed(1) + "%",
height: (o.rowSize[i] * 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: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : "" height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit :
BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.height)) { if (o.rowSize[i] === "" || o.rowSize[i] === "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));
if (BI.isNull(bottom[i])) { if (BI.isNull(bottom[i])) {
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; 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;
} }
if (item.height < 1 && item.height >= 0) { if (o.rowSize[i] < 1 && o.rowSize[i] > 0) {
w.element.css({
bottom: (bottom[i] * 100).toFixed(1) + "%",
height: (o.rowSize[i] * 100).toFixed(1) + "%"
});
} else if (item.height < 1 && item.height >= 0) {
w.element.css({ w.element.css({
bottom: (bottom[i] * 100).toFixed(1) + "%", bottom: (bottom[i] * 100).toFixed(1) + "%",
height: (item.height * 100).toFixed(1) + "%" height: (item.height * 100).toFixed(1) + "%"
@ -206,10 +249,14 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
} 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: BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : "" height: o.rowSize[i] > 0 ? o.rowSize[i] / BI.pixRatio + BI.pixUnit :
BI.isNumber(item.height) ? item.height / BI.pixRatio + BI.pixUnit : ""
}); });
} }
if (!BI.isNumber(item.height)) { if (o.rowSize[i] === "" || o.rowSize[i] === "fill") {
return true;
}
if (o.rowSize.length <= 0 && !BI.isNumber(item.height)) {
return true; return true;
} }
}); });

Loading…
Cancel
Save