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

Function setInfo

src/leaflet/overlay/LabelThemeLayer.js:869–908  ·  view source on GitHub ↗
(vec)

Source from the content-addressed store, hash-verified

867 //内部函数:设置避让信息
868 //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
869 function setInfo(vec) {
870 //四边形不在bounds内的节点
871 if (!bounds.contains(vec.x, vec.y)) {
872 //bounds的Top边
873 if (vec.y < bounds.top) {
874 let oY = Math.abs(bounds.top - vec.y);
875 if (oY > offsetY) {
876 offsetY = oY;
877 aspectH = "top";
878 }
879 }
880
881 //bounds的Bottom边
882 if (vec.y > bounds.bottom) {
883 let oY = Math.abs(vec.y - bounds.bottom);
884 if (oY > offsetY) {
885 offsetY = oY;
886 aspectH = "bottom";
887 }
888 }
889
890 //bounds的left边
891 if (vec.x < bounds.left) {
892 let oX = Math.abs(bounds.left - vec.x);
893 if (oX > offsetX) {
894 offsetX = oX;
895 aspectW = "left";
896 }
897 }
898
899 //bounds的right边
900 if (vec.x > bounds.right) {
901 let oX = Math.abs(vec.x - bounds.right);
902 if (oX > offsetX) {
903 offsetX = oX;
904 aspectW = "right";
905 }
906 }
907 }
908 }
909
910 },
911

Callers 3

getAvoidInfoMethod · 0.85
LabelThemeLayer.jsFile · 0.85
getAvoidInfoMethod · 0.85

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected