|
@@ -371,18 +371,15 @@ export default class Painter {
|
|
while (
|
|
while (
|
|
start + alreadyCount <= view.text.length &&
|
|
start + alreadyCount <= view.text.length &&
|
|
(width - measuredWith > view.css.fontSize.toPx() ||
|
|
(width - measuredWith > view.css.fontSize.toPx() ||
|
|
- (measuredWith > width && !isStop))
|
|
|
|
|
|
+ measuredWith > width)
|
|
) {
|
|
) {
|
|
if (measuredWith < width) {
|
|
if (measuredWith < width) {
|
|
- console.log("+++++++++", view.css.fontSize);
|
|
|
|
text = view.text.substr(start, ++alreadyCount);
|
|
text = view.text.substr(start, ++alreadyCount);
|
|
} else {
|
|
} else {
|
|
if (text.length <= 1) {
|
|
if (text.length <= 1) {
|
|
// 如果只有一个字符时,直接跳出循环
|
|
// 如果只有一个字符时,直接跳出循环
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- console.log("---------", view.css.fontSize);
|
|
|
|
-
|
|
|
|
text = view.text.substr(start, --alreadyCount);
|
|
text = view.text.substr(start, --alreadyCount);
|
|
}
|
|
}
|
|
measuredWith = this.ctx.measureText(text).width;
|
|
measuredWith = this.ctx.measureText(text).width;
|
|
@@ -400,7 +397,6 @@ export default class Painter {
|
|
text += "...";
|
|
text += "...";
|
|
measuredWith = this.ctx.measureText(text).width;
|
|
measuredWith = this.ctx.measureText(text).width;
|
|
}
|
|
}
|
|
- console.log("ssss====", text, measuredWith);
|
|
|
|
this.ctx.setTextAlign(view.css.align ? view.css.align : "left");
|
|
this.ctx.setTextAlign(view.css.align ? view.css.align : "left");
|
|
let x;
|
|
let x;
|
|
switch (view.css.align) {
|
|
switch (view.css.align) {
|