提交 a242f943 编写于 作者: P pah100

fix title textAlign setting.

上级 63c22ab0
......@@ -152,6 +152,11 @@ define(function(require) {
if (textAlign === 'middle') {
textAlign = 'center';
}
// If textAlign is illegal, canvas render text with textAlign 'left' and 'right'
// alternatively (after optimized that ctx.save/restore are not called if no change).
if (textAlign !== 'left' && textAlign !== 'right' && textAlign !== 'center') {
textAlign = 'left';
}
// Adjust layout by text align
if (textAlign === 'right') {
layoutRect.x += layoutRect.width;
......@@ -160,7 +165,8 @@ define(function(require) {
layoutRect.x += layoutRect.width / 2;
}
}
group.position = [layoutRect.x, layoutRect.y];
group.attr('position', [layoutRect.x, layoutRect.y]);
textEl.setStyle('textAlign', textAlign);
subTextEl.setStyle('textAlign', textAlign);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册