Browse Source

无JIRA任务, label _createNotCenterEl的时候要根据textAlign来决定用vertical_adapt还是right_vertical_adapt

es6
dailer 6 years ago
parent
commit
38a8b9c46b
  1. 11
      src/base/single/label/html.label.js
  2. 11
      src/base/single/label/label.js

11
src/base/single/label/html.label.js

@ -194,13 +194,14 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
_createNotCenterEl: function () { _createNotCenterEl: function () {
var o = this.options; var o = this.options;
var adaptLayout = o.textAlign === "right" ? "bi.right_vertical_adapt" : "bi.vertical_adapt";
var json = this._createJson(); var json = this._createJson();
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.width = o.textWidth; json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { if (BI.isNumber(o.height) && o.height > 0) {
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
height: o.height, height: o.height,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
element: this, element: this,
@ -213,7 +214,7 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
return; return;
} }
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -249,7 +250,7 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
} }
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -267,7 +268,7 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -314,7 +315,7 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
maxWidth: "100%" maxWidth: "100%"
})); }));
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
element: this, element: this,
items: [this.text] items: [this.text]
}); });

11
src/base/single/label/label.js

@ -203,13 +203,14 @@ BI.Label = BI.inherit(BI.Single, {
_createNotCenterEl: function () { _createNotCenterEl: function () {
var o = this.options; var o = this.options;
var adaptLayout = o.textAlign === "right" ? "bi.right_vertical_adapt" : "bi.vertical_adapt";
var json = this._createJson(); var json = this._createJson();
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.width = o.textWidth; json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { // 2.1 if (BI.isNumber(o.height) && o.height > 0) { // 2.1
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
height: o.height, height: o.height,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
element: this, element: this,
@ -222,7 +223,7 @@ BI.Label = BI.inherit(BI.Single, {
return; return;
} }
BI.createWidget({ // 2.2 BI.createWidget({ // 2.2
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -258,7 +259,7 @@ BI.Label = BI.inherit(BI.Single, {
} }
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({ // 2.4 BI.createWidget({ // 2.4
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -276,7 +277,7 @@ BI.Label = BI.inherit(BI.Single, {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth; json.width = o.textWidth;
BI.createWidget({ // 2.5 BI.createWidget({ // 2.5
type: "bi.vertical_adapt", type: adaptLayout,
scrollable: o.whiteSpace === "normal", scrollable: o.whiteSpace === "normal",
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
@ -323,7 +324,7 @@ BI.Label = BI.inherit(BI.Single, {
maxWidth: "100%" maxWidth: "100%"
})); }));
BI.createWidget({ BI.createWidget({
type: "bi.vertical_adapt", type: adaptLayout,
element: this, element: this,
items: [this.text] items: [this.text]
}); });

Loading…
Cancel
Save