MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / rotateTextRect

Function rotateTextRect

libs/echarts/echarts.simple.js:37943–37953  ·  view source on GitHub ↗
(textRect, rotate)

Source from the content-addressed store, hash-verified

37941}
37942
37943function rotateTextRect(textRect, rotate) {
37944 var rotateRadians = rotate * Math.PI / 180;
37945 var boundingBox = textRect.plain();
37946 var beforeWidth = boundingBox.width;
37947 var beforeHeight = boundingBox.height;
37948 var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
37949 var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
37950 var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
37951
37952 return rotatedRect;
37953}
37954
37955/**
37956 * @param {module:echarts/src/model/Model} model axisLabelModel or axisTickModel

Callers 1

estimateLabelUnionRectFunction · 0.70

Calls 2

cosMethod · 0.80
sinMethod · 0.80

Tested by

no test coverage detected