提交 fd5e609f 编写于 作者: L lang

Optimize title textAlign

上级 4e37451c
...@@ -148,18 +148,23 @@ define(function(require) { ...@@ -148,18 +148,23 @@ define(function(require) {
var p = layoutRect.x / api.getWidth(); var p = layoutRect.x / api.getWidth();
var p2 = (layoutRect.x + layoutRect.width) / api.getWidth(); var p2 = (layoutRect.x + layoutRect.width) / api.getWidth();
if (p < 0.2) { if (p < 0.1) {
textAlign = 'left'; textAlign = 'left';
} }
else if (p2 > 0.8) { else if (p2 > 0.9) {
layoutRect.x += layoutRect.width;
textAlign = 'right'; textAlign = 'right';
} }
else { else {
layoutRect.x += layoutRect.width / 2;
textAlign = 'center'; textAlign = 'center';
} }
} }
// Adjust layout by text align
if (textAlign === 'right') {
layoutRect.x += layoutRect.width;
}
else if (textAlign === 'center') {
layoutRect.x += layoutRect.width / 2;
}
group.position = [layoutRect.x, layoutRect.y]; group.position = [layoutRect.x, layoutRect.y];
textEl.setStyle('textAlign', textAlign); textEl.setStyle('textAlign', textAlign);
subTextEl.setStyle('textAlign', textAlign); subTextEl.setStyle('textAlign', textAlign);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册