(ctx, style, rect, x, y)
| 8678 | } |
| 8679 | |
| 8680 | function applyTextRotation(ctx, style, rect, x, y) { |
| 8681 | // textRotation only apply in RectText. |
| 8682 | if (rect && style.textRotation) { |
| 8683 | var origin = style.textOrigin; |
| 8684 | if (origin === 'center') { |
| 8685 | x = rect.width / 2 + rect.x; |
| 8686 | y = rect.height / 2 + rect.y; |
| 8687 | } |
| 8688 | else if (origin) { |
| 8689 | x = origin[0] + rect.x; |
| 8690 | y = origin[1] + rect.y; |
| 8691 | } |
| 8692 | |
| 8693 | ctx.translate(x, y); |
| 8694 | // Positive: anticlockwise |
| 8695 | ctx.rotate(-style.textRotation); |
| 8696 | ctx.translate(-x, -y); |
| 8697 | } |
| 8698 | } |
| 8699 | |
| 8700 | function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign) { |
| 8701 | var tokenStyle = style.rich[token.styleName] || {}; |
no test coverage detected