microboard-temp 0.5.91 → 0.5.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +18 -8
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/node.js +18 -8
- package/dist/esm/browser.js +18 -8
- package/dist/esm/index.js +18 -8
- package/dist/esm/node.js +18 -8
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36924,6 +36924,20 @@ function reconstructPath(node2) {
|
|
|
36924
36924
|
}
|
|
36925
36925
|
return path2.reverse();
|
|
36926
36926
|
}
|
|
36927
|
+
function findClosestPointInGrid(point5, grid) {
|
|
36928
|
+
let closestPoint = grid[0][0];
|
|
36929
|
+
let minDistance = Infinity;
|
|
36930
|
+
for (const row2 of grid) {
|
|
36931
|
+
for (const gridPoint of row2) {
|
|
36932
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36933
|
+
if (distance < minDistance) {
|
|
36934
|
+
minDistance = distance;
|
|
36935
|
+
closestPoint = gridPoint;
|
|
36936
|
+
}
|
|
36937
|
+
}
|
|
36938
|
+
}
|
|
36939
|
+
return closestPoint;
|
|
36940
|
+
}
|
|
36927
36941
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36928
36942
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36929
36943
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -36978,19 +36992,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36978
36992
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36979
36993
|
const finalStart = newStart || start;
|
|
36980
36994
|
const finalEnd = newEnd || end;
|
|
36981
|
-
const
|
|
36982
|
-
const uniquePoints =
|
|
36995
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
36996
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
36983
36997
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36984
36998
|
acc.push(p3);
|
|
36985
36999
|
}
|
|
36986
37000
|
return acc;
|
|
36987
37001
|
}, []);
|
|
36988
|
-
const
|
|
36989
|
-
|
|
36990
|
-
lines: getLines(pathPoints),
|
|
36991
|
-
newStart,
|
|
36992
|
-
newEnd
|
|
36993
|
-
});
|
|
37002
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
37003
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
36994
37004
|
return {
|
|
36995
37005
|
lines: getLines(pathPoints),
|
|
36996
37006
|
newStart,
|
package/dist/cjs/index.js
CHANGED
|
@@ -36924,6 +36924,20 @@ function reconstructPath(node2) {
|
|
|
36924
36924
|
}
|
|
36925
36925
|
return path2.reverse();
|
|
36926
36926
|
}
|
|
36927
|
+
function findClosestPointInGrid(point5, grid) {
|
|
36928
|
+
let closestPoint = grid[0][0];
|
|
36929
|
+
let minDistance = Infinity;
|
|
36930
|
+
for (const row2 of grid) {
|
|
36931
|
+
for (const gridPoint of row2) {
|
|
36932
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36933
|
+
if (distance < minDistance) {
|
|
36934
|
+
minDistance = distance;
|
|
36935
|
+
closestPoint = gridPoint;
|
|
36936
|
+
}
|
|
36937
|
+
}
|
|
36938
|
+
}
|
|
36939
|
+
return closestPoint;
|
|
36940
|
+
}
|
|
36927
36941
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36928
36942
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36929
36943
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -36978,19 +36992,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36978
36992
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36979
36993
|
const finalStart = newStart || start;
|
|
36980
36994
|
const finalEnd = newEnd || end;
|
|
36981
|
-
const
|
|
36982
|
-
const uniquePoints =
|
|
36995
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
36996
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
36983
36997
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36984
36998
|
acc.push(p3);
|
|
36985
36999
|
}
|
|
36986
37000
|
return acc;
|
|
36987
37001
|
}, []);
|
|
36988
|
-
const
|
|
36989
|
-
|
|
36990
|
-
lines: getLines(pathPoints),
|
|
36991
|
-
newStart,
|
|
36992
|
-
newEnd
|
|
36993
|
-
});
|
|
37002
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
37003
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
36994
37004
|
return {
|
|
36995
37005
|
lines: getLines(pathPoints),
|
|
36996
37006
|
newStart,
|
package/dist/cjs/node.js
CHANGED
|
@@ -39397,6 +39397,20 @@ function reconstructPath(node2) {
|
|
|
39397
39397
|
}
|
|
39398
39398
|
return path2.reverse();
|
|
39399
39399
|
}
|
|
39400
|
+
function findClosestPointInGrid(point5, grid) {
|
|
39401
|
+
let closestPoint = grid[0][0];
|
|
39402
|
+
let minDistance = Infinity;
|
|
39403
|
+
for (const row2 of grid) {
|
|
39404
|
+
for (const gridPoint of row2) {
|
|
39405
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
39406
|
+
if (distance < minDistance) {
|
|
39407
|
+
minDistance = distance;
|
|
39408
|
+
closestPoint = gridPoint;
|
|
39409
|
+
}
|
|
39410
|
+
}
|
|
39411
|
+
}
|
|
39412
|
+
return closestPoint;
|
|
39413
|
+
}
|
|
39400
39414
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
39401
39415
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
39402
39416
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -39451,19 +39465,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39451
39465
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
39452
39466
|
const finalStart = newStart || start;
|
|
39453
39467
|
const finalEnd = newEnd || end;
|
|
39454
|
-
const
|
|
39455
|
-
const uniquePoints =
|
|
39468
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
39469
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
39456
39470
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
39457
39471
|
acc.push(p3);
|
|
39458
39472
|
}
|
|
39459
39473
|
return acc;
|
|
39460
39474
|
}, []);
|
|
39461
|
-
const
|
|
39462
|
-
|
|
39463
|
-
lines: getLines(pathPoints),
|
|
39464
|
-
newStart,
|
|
39465
|
-
newEnd
|
|
39466
|
-
});
|
|
39475
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
39476
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
39467
39477
|
return {
|
|
39468
39478
|
lines: getLines(pathPoints),
|
|
39469
39479
|
newStart,
|
package/dist/esm/browser.js
CHANGED
|
@@ -36769,6 +36769,20 @@ function reconstructPath(node2) {
|
|
|
36769
36769
|
}
|
|
36770
36770
|
return path2.reverse();
|
|
36771
36771
|
}
|
|
36772
|
+
function findClosestPointInGrid(point5, grid) {
|
|
36773
|
+
let closestPoint = grid[0][0];
|
|
36774
|
+
let minDistance = Infinity;
|
|
36775
|
+
for (const row2 of grid) {
|
|
36776
|
+
for (const gridPoint of row2) {
|
|
36777
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36778
|
+
if (distance < minDistance) {
|
|
36779
|
+
minDistance = distance;
|
|
36780
|
+
closestPoint = gridPoint;
|
|
36781
|
+
}
|
|
36782
|
+
}
|
|
36783
|
+
}
|
|
36784
|
+
return closestPoint;
|
|
36785
|
+
}
|
|
36772
36786
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36773
36787
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36774
36788
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -36823,19 +36837,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36823
36837
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36824
36838
|
const finalStart = newStart || start;
|
|
36825
36839
|
const finalEnd = newEnd || end;
|
|
36826
|
-
const
|
|
36827
|
-
const uniquePoints =
|
|
36840
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
36841
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
36828
36842
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36829
36843
|
acc.push(p3);
|
|
36830
36844
|
}
|
|
36831
36845
|
return acc;
|
|
36832
36846
|
}, []);
|
|
36833
|
-
const
|
|
36834
|
-
|
|
36835
|
-
lines: getLines(pathPoints),
|
|
36836
|
-
newStart,
|
|
36837
|
-
newEnd
|
|
36838
|
-
});
|
|
36847
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
36848
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
36839
36849
|
return {
|
|
36840
36850
|
lines: getLines(pathPoints),
|
|
36841
36851
|
newStart,
|
package/dist/esm/index.js
CHANGED
|
@@ -36762,6 +36762,20 @@ function reconstructPath(node2) {
|
|
|
36762
36762
|
}
|
|
36763
36763
|
return path2.reverse();
|
|
36764
36764
|
}
|
|
36765
|
+
function findClosestPointInGrid(point5, grid) {
|
|
36766
|
+
let closestPoint = grid[0][0];
|
|
36767
|
+
let minDistance = Infinity;
|
|
36768
|
+
for (const row2 of grid) {
|
|
36769
|
+
for (const gridPoint of row2) {
|
|
36770
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36771
|
+
if (distance < minDistance) {
|
|
36772
|
+
minDistance = distance;
|
|
36773
|
+
closestPoint = gridPoint;
|
|
36774
|
+
}
|
|
36775
|
+
}
|
|
36776
|
+
}
|
|
36777
|
+
return closestPoint;
|
|
36778
|
+
}
|
|
36765
36779
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36766
36780
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36767
36781
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -36816,19 +36830,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36816
36830
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36817
36831
|
const finalStart = newStart || start;
|
|
36818
36832
|
const finalEnd = newEnd || end;
|
|
36819
|
-
const
|
|
36820
|
-
const uniquePoints =
|
|
36833
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
36834
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
36821
36835
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36822
36836
|
acc.push(p3);
|
|
36823
36837
|
}
|
|
36824
36838
|
return acc;
|
|
36825
36839
|
}, []);
|
|
36826
|
-
const
|
|
36827
|
-
|
|
36828
|
-
lines: getLines(pathPoints),
|
|
36829
|
-
newStart,
|
|
36830
|
-
newEnd
|
|
36831
|
-
});
|
|
36840
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
36841
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
36832
36842
|
return {
|
|
36833
36843
|
lines: getLines(pathPoints),
|
|
36834
36844
|
newStart,
|
package/dist/esm/node.js
CHANGED
|
@@ -39230,6 +39230,20 @@ function reconstructPath(node2) {
|
|
|
39230
39230
|
}
|
|
39231
39231
|
return path2.reverse();
|
|
39232
39232
|
}
|
|
39233
|
+
function findClosestPointInGrid(point5, grid) {
|
|
39234
|
+
let closestPoint = grid[0][0];
|
|
39235
|
+
let minDistance = Infinity;
|
|
39236
|
+
for (const row2 of grid) {
|
|
39237
|
+
for (const gridPoint of row2) {
|
|
39238
|
+
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
39239
|
+
if (distance < minDistance) {
|
|
39240
|
+
minDistance = distance;
|
|
39241
|
+
closestPoint = gridPoint;
|
|
39242
|
+
}
|
|
39243
|
+
}
|
|
39244
|
+
}
|
|
39245
|
+
return closestPoint;
|
|
39246
|
+
}
|
|
39233
39247
|
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
39234
39248
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
39235
39249
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
@@ -39284,19 +39298,15 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39284
39298
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
39285
39299
|
const finalStart = newStart || start;
|
|
39286
39300
|
const finalEnd = newEnd || end;
|
|
39287
|
-
const
|
|
39288
|
-
const uniquePoints =
|
|
39301
|
+
const pointsToVisit = [finalStart, ...allWaypoints, finalEnd];
|
|
39302
|
+
const uniquePoints = pointsToVisit.reduce((acc, p3) => {
|
|
39289
39303
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
39290
39304
|
acc.push(p3);
|
|
39291
39305
|
}
|
|
39292
39306
|
return acc;
|
|
39293
39307
|
}, []);
|
|
39294
|
-
const
|
|
39295
|
-
|
|
39296
|
-
lines: getLines(pathPoints),
|
|
39297
|
-
newStart,
|
|
39298
|
-
newEnd
|
|
39299
|
-
});
|
|
39308
|
+
const snappedPoints = uniquePoints.map((p3) => findClosestPointInGrid(p3, grid));
|
|
39309
|
+
const pathPoints = findPathPoints(snappedPoints, grid, obstacles, newStart, newEnd);
|
|
39300
39310
|
return {
|
|
39301
39311
|
lines: getLines(pathPoints),
|
|
39302
39312
|
newStart,
|