![](/img/trans.png)
[英]Leaflet GeoJSON Uncaught TypeError: Cannot read properties of undefined (reading 'x')
[英]Uncaught TypeError: Cannot read properties of undefined (reading 'x')
我正在使用 react 編寫應用程序,但出現此錯誤 - Uncaught TypeError: Cannot read properties of undefined (reading 'x') at calculateIntersectionX。 當限制常數中有合法的 x 部分時,我真的不知道為什么會收到此錯誤。
const limits = [
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
];
for (var i = 0; i < limits.length; i++) {
for (var g = 0; g < limits.length; i++) {
if (limits[i] != limits[g]) {
let a1 = limits[i];
let a2 = limits[g];
calculateIntersectionX(avgfakex1, avgfakex2, a1, a2);
calculateIntersectionY(avgfakey1, avgfakey2, a1, a2);
}
}
}
function calculateIntersectionX(p1, p2, p3, p4) {
var c2x = p3.x - p4.x; // (x3 - x4)
var c3x = p1.x - p2.x; // (x1 - x2)
var c2y = p3.y - p4.y; // (y3 - y4)
var c3y = p1.y - p2.y; // (y1 - y2)
我認為你必須改變:
考慮修復這些,也許它會幫助你弄清楚:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.