Browse Source

Pull request #2246: 无JIRA任务 统一都采用maxWidth

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

* commit 'afc8b04feb686b5a61b5f0d64d37408d3cd78279':
  统一都采用maxWidth
es6
guy 3 years ago
parent
commit
08b70303a3
  1. 15
      src/base/single/label/abstract.label.js

15
src/base/single/label/abstract.label.js

@ -26,7 +26,7 @@
var o = this.options; var o = this.options;
return { return {
type: "bi.text", type: "bi.text",
textAlign: o.textAlign, textAlign: "left",
whiteSpace: o.whiteSpace, whiteSpace: o.whiteSpace,
lineHeight: o.textHeight, lineHeight: o.textHeight,
maxWidth: "100%", maxWidth: "100%",
@ -50,7 +50,6 @@
_createCenterEl: function () { _createCenterEl: function () {
var o = this.options; var o = this.options;
var json = this._createJson(); var json = this._createJson();
json.textAlign = "left";
if (BI.isNumber(o.width) && o.width > 0) { if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.maxWidth = o.textWidth; json.maxWidth = o.textWidth;
@ -246,6 +245,12 @@
return; return;
} }
if (BI.isNumber(o.height) && o.height > 0) { // 2.3 if (BI.isNumber(o.height) && o.height > 0) { // 2.3
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
});
}
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, { this.text = BI.createWidget(BI.extend(json, {
element: this, element: this,
hgap: o.hgap, hgap: o.hgap,
@ -255,11 +260,6 @@
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap bgap: o.bgap
})); }));
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
});
}
return; return;
} }
json.maxWidth = o.width - 2 * o.hgap - o.lgap - o.rgap; json.maxWidth = o.width - 2 * o.hgap - o.lgap - o.rgap;
@ -309,6 +309,7 @@
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit "line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit
}); });
} }
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, { // 2.6 this.text = BI.createWidget(BI.extend(json, { // 2.6
element: this, element: this,
hgap: o.hgap, hgap: o.hgap,

Loading…
Cancel
Save