* 得到绘制的起点位置,根据align不同,位置也不同 * @param textAlign * @returns {number}
(textAlign, canvasWidth)
| 900 | * @returns {number} |
| 901 | */ |
| 902 | static getPositionX(textAlign, canvasWidth) { |
| 903 | let x; |
| 904 | let width = canvasWidth - doublePadding; //减去padding |
| 905 | switch (textAlign) { |
| 906 | case 'center': |
| 907 | x = width / 2; |
| 908 | break; |
| 909 | case 'right': |
| 910 | x = width; |
| 911 | break; |
| 912 | default: |
| 913 | x = 8; |
| 914 | break; |
| 915 | } |
| 916 | return x; |
| 917 | } |
| 918 | |
| 919 | /** |
| 920 | * @function StyleUtils.hexToRgb |
no outgoing calls
no test coverage detected