Skip to content

Commit

Permalink
🐛 fix: fix position bug due to sketch text align parsing error
Browse files Browse the repository at this point in the history
ref: #51 close #51
  • Loading branch information
arvinxx committed May 13, 2021
1 parent 0ab7ffb commit 1dce98f
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/models/Style/TextStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,21 @@ class TextStyle {
* 取得 sketch 下的横向对齐参数
*/
getSketchHorizontalAlign = () => {
switch (this.textAlign) {
case 'left':
default:
return SketchFormat.TextHorizontalAlignment.Left;
case 'right':
return SketchFormat.TextHorizontalAlignment.Right;
case 'center':
return SketchFormat.TextHorizontalAlignment.Centered;
case 'justify':
return SketchFormat.TextHorizontalAlignment.Justified;
}
// 默认使用左对齐
return SketchFormat.TextHorizontalAlignment.Left;

// 相关 Bug https://github.com/ant-design/html2sketch/issues/51
// switch (this.textAlign) {
// case 'left':
// default:
// return SketchFormat.TextHorizontalAlignment.Left;
// case 'right':
// return SketchFormat.TextHorizontalAlignment.Right;
// case 'center':
// return SketchFormat.TextHorizontalAlignment.Centered;
// case 'justify':
// return SketchFormat.TextHorizontalAlignment.Justified;
// }
};

/**
Expand Down

0 comments on commit 1dce98f

Please sign in to comment.