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

Function adjustSingleSide

libs/echarts/echarts.simple.js:43888–43995  ·  view source on GitHub ↗
(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft, viewTop, farthestX)

Source from the content-addressed store, hash-verified

43886var RADIAN$1 = Math.PI / 180;
43887
43888function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft, viewTop, farthestX) {
43889 list.sort(function (a, b) {
43890 return a.y - b.y;
43891 });
43892
43893 function shiftDown(start, end, delta, dir) {
43894 for (var j = start; j < end; j++) {
43895 if (list[j].y + delta > viewTop + viewHeight) {
43896 break;
43897 }
43898
43899 list[j].y += delta;
43900 if (j > start
43901 && j + 1 < end
43902 && list[j + 1].y > list[j].y + list[j].height
43903 ) {
43904 shiftUp(j, delta / 2);
43905 return;
43906 }
43907 }
43908
43909 shiftUp(end - 1, delta / 2);
43910 }
43911
43912 function shiftUp(end, delta) {
43913 for (var j = end; j >= 0; j--) {
43914 if (list[j].y - delta < viewTop) {
43915 break;
43916 }
43917
43918 list[j].y -= delta;
43919 if (j > 0
43920 && list[j].y > list[j - 1].y + list[j - 1].height
43921 ) {
43922 break;
43923 }
43924 }
43925 }
43926
43927 function changeX(list, isDownList, cx, cy, r, dir) {
43928 var lastDeltaX = dir > 0
43929 ? isDownList // right-side
43930 ? Number.MAX_VALUE // down
43931 : 0 // up
43932 : isDownList // left-side
43933 ? Number.MAX_VALUE // down
43934 : 0; // up
43935
43936 for (var i = 0, l = list.length; i < l; i++) {
43937 if (list[i].labelAlignTo !== 'none') {
43938 continue;
43939 }
43940
43941 var deltaY = Math.abs(list[i].y - cy);
43942 var length = list[i].len;
43943 var length2 = list[i].len2;
43944 var deltaX = (deltaY < r + length)
43945 ? Math.sqrt(

Callers 1

avoidOverlapFunction · 0.70

Calls 4

pushMethod · 0.80
shiftDownFunction · 0.70
shiftUpFunction · 0.70
changeXFunction · 0.70

Tested by

no test coverage detected