| 881 | //内部函数:设置避让信息 |
| 882 | //参数:{Object} vec- quadrilateral四边形单个节点。如:{"x":1,"y":1}。 |
| 883 | function setInfo(vec) { |
| 884 | //四边形不在bounds内的节点 |
| 885 | if (!bounds.contains(vec.x, vec.y)) { |
| 886 | //bounds的Top边 |
| 887 | if (vec.y < bounds.top) { |
| 888 | let oY = Math.abs(bounds.top - vec.y); |
| 889 | if (oY > offsetY) { |
| 890 | offsetY = oY; |
| 891 | aspectH = "top"; |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | //bounds的Bottom边 |
| 896 | if (vec.y > bounds.bottom) { |
| 897 | let oY = Math.abs(vec.y - bounds.bottom); |
| 898 | if (oY > offsetY) { |
| 899 | offsetY = oY; |
| 900 | aspectH = "bottom"; |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | //bounds的left边 |
| 905 | if (vec.x < bounds.left) { |
| 906 | let oX = Math.abs(bounds.left - vec.x); |
| 907 | if (oX > offsetX) { |
| 908 | offsetX = oX; |
| 909 | aspectW = "left"; |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | //bounds的right边 |
| 914 | if (vec.x > bounds.right) { |
| 915 | let oX = Math.abs(vec.x - bounds.right); |
| 916 | if (oX > offsetX) { |
| 917 | offsetX = oX; |
| 918 | aspectW = "right"; |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | } |
| 925 | |