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

Function isTwoLabelOverlapped

libs/echarts/echarts.simple.js:40827–40845  ·  view source on GitHub ↗
(current, next, labelLayout)

Source from the content-addressed store, hash-verified

40825}
40826
40827function isTwoLabelOverlapped(current, next, labelLayout) {
40828 // current and next has the same rotation.
40829 var firstRect = current && current.getBoundingRect().clone();
40830 var nextRect = next && next.getBoundingRect().clone();
40831
40832 if (!firstRect || !nextRect) {
40833 return;
40834 }
40835
40836 // When checking intersect of two rotated labels, we use mRotationBack
40837 // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.
40838 var mRotationBack = identity([]);
40839 rotate(mRotationBack, mRotationBack, -current.rotation);
40840
40841 firstRect.applyTransform(mul$1([], mRotationBack, current.getLocalTransform()));
40842 nextRect.applyTransform(mul$1([], mRotationBack, next.getLocalTransform()));
40843
40844 return firstRect.intersect(nextRect);
40845}
40846
40847function isNameLocationCenter(nameLocation) {
40848 return nameLocation === 'middle' || nameLocation === 'center';

Callers 1

fixMinMaxLabelShowFunction · 0.70

Calls 5

applyTransformMethod · 0.80
identityFunction · 0.70
rotateFunction · 0.70
mul$1Function · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected