MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / applyTextRotation

Function applyTextRotation

libs/echarts/echarts.simple.js:8680–8698  ·  view source on GitHub ↗
(ctx, style, rect, x, y)

Source from the content-addressed store, hash-verified

8678}
8679
8680function 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
8700function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign) {
8701 var tokenStyle = style.rich[token.styleName] || {};

Callers 2

renderPlainTextFunction · 0.70
drawRichTextFunction · 0.70

Calls 2

translateMethod · 0.80
rotateMethod · 0.45

Tested by

no test coverage detected