microboard-temp 0.5.93 → 0.5.94
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 +7 -20
- package/dist/cjs/index.js +7 -20
- package/dist/cjs/node.js +7 -20
- package/dist/esm/browser.js +7 -20
- package/dist/esm/index.js +7 -20
- package/dist/esm/node.js +7 -20
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36967,20 +36967,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
36967
36967
|
}
|
|
36968
36968
|
return [];
|
|
36969
36969
|
}
|
|
36970
|
-
function findClosestPointInGrid(point5, grid) {
|
|
36971
|
-
let closestPoint = grid[0][0];
|
|
36972
|
-
let minDistance = Infinity;
|
|
36973
|
-
for (const row2 of grid) {
|
|
36974
|
-
for (const gridPoint of row2) {
|
|
36975
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36976
|
-
if (distance < minDistance) {
|
|
36977
|
-
minDistance = distance;
|
|
36978
|
-
closestPoint = gridPoint;
|
|
36979
|
-
}
|
|
36980
|
-
}
|
|
36981
|
-
}
|
|
36982
|
-
return closestPoint;
|
|
36983
|
-
}
|
|
36984
36970
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
36985
36971
|
let closestPoint = null;
|
|
36986
36972
|
let minDistance = Infinity;
|
|
@@ -36999,7 +36985,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
36999
36985
|
return closestPoint;
|
|
37000
36986
|
}
|
|
37001
36987
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
37002
|
-
const tempGridInfo = createGrid(start, end);
|
|
36988
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
37003
36989
|
const startPoint = tempGridInfo.newStart || start;
|
|
37004
36990
|
const endPoint = tempGridInfo.newEnd || end;
|
|
37005
36991
|
const startDir = getPointerDirection(start);
|
|
@@ -37009,11 +36995,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
37009
36995
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
37010
36996
|
const finalStart = newStart || start;
|
|
37011
36997
|
const finalEnd = newEnd || end;
|
|
37012
|
-
const
|
|
37013
|
-
const
|
|
37014
|
-
|
|
37015
|
-
|
|
37016
|
-
|
|
36998
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
36999
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
37000
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
37001
|
+
return { lines: [], newStart, newEnd };
|
|
37002
|
+
}
|
|
37003
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
37017
37004
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
37018
37005
|
acc.push(p3);
|
|
37019
37006
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -36967,20 +36967,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
36967
36967
|
}
|
|
36968
36968
|
return [];
|
|
36969
36969
|
}
|
|
36970
|
-
function findClosestPointInGrid(point5, grid) {
|
|
36971
|
-
let closestPoint = grid[0][0];
|
|
36972
|
-
let minDistance = Infinity;
|
|
36973
|
-
for (const row2 of grid) {
|
|
36974
|
-
for (const gridPoint of row2) {
|
|
36975
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36976
|
-
if (distance < minDistance) {
|
|
36977
|
-
minDistance = distance;
|
|
36978
|
-
closestPoint = gridPoint;
|
|
36979
|
-
}
|
|
36980
|
-
}
|
|
36981
|
-
}
|
|
36982
|
-
return closestPoint;
|
|
36983
|
-
}
|
|
36984
36970
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
36985
36971
|
let closestPoint = null;
|
|
36986
36972
|
let minDistance = Infinity;
|
|
@@ -36999,7 +36985,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
36999
36985
|
return closestPoint;
|
|
37000
36986
|
}
|
|
37001
36987
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
37002
|
-
const tempGridInfo = createGrid(start, end);
|
|
36988
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
37003
36989
|
const startPoint = tempGridInfo.newStart || start;
|
|
37004
36990
|
const endPoint = tempGridInfo.newEnd || end;
|
|
37005
36991
|
const startDir = getPointerDirection(start);
|
|
@@ -37009,11 +36995,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
37009
36995
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
37010
36996
|
const finalStart = newStart || start;
|
|
37011
36997
|
const finalEnd = newEnd || end;
|
|
37012
|
-
const
|
|
37013
|
-
const
|
|
37014
|
-
|
|
37015
|
-
|
|
37016
|
-
|
|
36998
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
36999
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
37000
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
37001
|
+
return { lines: [], newStart, newEnd };
|
|
37002
|
+
}
|
|
37003
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
37017
37004
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
37018
37005
|
acc.push(p3);
|
|
37019
37006
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -39440,20 +39440,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
39440
39440
|
}
|
|
39441
39441
|
return [];
|
|
39442
39442
|
}
|
|
39443
|
-
function findClosestPointInGrid(point5, grid) {
|
|
39444
|
-
let closestPoint = grid[0][0];
|
|
39445
|
-
let minDistance = Infinity;
|
|
39446
|
-
for (const row2 of grid) {
|
|
39447
|
-
for (const gridPoint of row2) {
|
|
39448
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
39449
|
-
if (distance < minDistance) {
|
|
39450
|
-
minDistance = distance;
|
|
39451
|
-
closestPoint = gridPoint;
|
|
39452
|
-
}
|
|
39453
|
-
}
|
|
39454
|
-
}
|
|
39455
|
-
return closestPoint;
|
|
39456
|
-
}
|
|
39457
39443
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
39458
39444
|
let closestPoint = null;
|
|
39459
39445
|
let minDistance = Infinity;
|
|
@@ -39472,7 +39458,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
39472
39458
|
return closestPoint;
|
|
39473
39459
|
}
|
|
39474
39460
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
39475
|
-
const tempGridInfo = createGrid(start, end);
|
|
39461
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
39476
39462
|
const startPoint = tempGridInfo.newStart || start;
|
|
39477
39463
|
const endPoint = tempGridInfo.newEnd || end;
|
|
39478
39464
|
const startDir = getPointerDirection(start);
|
|
@@ -39482,11 +39468,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39482
39468
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
39483
39469
|
const finalStart = newStart || start;
|
|
39484
39470
|
const finalEnd = newEnd || end;
|
|
39485
|
-
const
|
|
39486
|
-
const
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
|
|
39471
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
39472
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
39473
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
39474
|
+
return { lines: [], newStart, newEnd };
|
|
39475
|
+
}
|
|
39476
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
39490
39477
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
39491
39478
|
acc.push(p3);
|
|
39492
39479
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -36812,20 +36812,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
36812
36812
|
}
|
|
36813
36813
|
return [];
|
|
36814
36814
|
}
|
|
36815
|
-
function findClosestPointInGrid(point5, grid) {
|
|
36816
|
-
let closestPoint = grid[0][0];
|
|
36817
|
-
let minDistance = Infinity;
|
|
36818
|
-
for (const row2 of grid) {
|
|
36819
|
-
for (const gridPoint of row2) {
|
|
36820
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36821
|
-
if (distance < minDistance) {
|
|
36822
|
-
minDistance = distance;
|
|
36823
|
-
closestPoint = gridPoint;
|
|
36824
|
-
}
|
|
36825
|
-
}
|
|
36826
|
-
}
|
|
36827
|
-
return closestPoint;
|
|
36828
|
-
}
|
|
36829
36815
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
36830
36816
|
let closestPoint = null;
|
|
36831
36817
|
let minDistance = Infinity;
|
|
@@ -36844,7 +36830,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
36844
36830
|
return closestPoint;
|
|
36845
36831
|
}
|
|
36846
36832
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36847
|
-
const tempGridInfo = createGrid(start, end);
|
|
36833
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
36848
36834
|
const startPoint = tempGridInfo.newStart || start;
|
|
36849
36835
|
const endPoint = tempGridInfo.newEnd || end;
|
|
36850
36836
|
const startDir = getPointerDirection(start);
|
|
@@ -36854,11 +36840,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36854
36840
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36855
36841
|
const finalStart = newStart || start;
|
|
36856
36842
|
const finalEnd = newEnd || end;
|
|
36857
|
-
const
|
|
36858
|
-
const
|
|
36859
|
-
|
|
36860
|
-
|
|
36861
|
-
|
|
36843
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
36844
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
36845
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
36846
|
+
return { lines: [], newStart, newEnd };
|
|
36847
|
+
}
|
|
36848
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
36862
36849
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36863
36850
|
acc.push(p3);
|
|
36864
36851
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -36805,20 +36805,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
36805
36805
|
}
|
|
36806
36806
|
return [];
|
|
36807
36807
|
}
|
|
36808
|
-
function findClosestPointInGrid(point5, grid) {
|
|
36809
|
-
let closestPoint = grid[0][0];
|
|
36810
|
-
let minDistance = Infinity;
|
|
36811
|
-
for (const row2 of grid) {
|
|
36812
|
-
for (const gridPoint of row2) {
|
|
36813
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
36814
|
-
if (distance < minDistance) {
|
|
36815
|
-
minDistance = distance;
|
|
36816
|
-
closestPoint = gridPoint;
|
|
36817
|
-
}
|
|
36818
|
-
}
|
|
36819
|
-
}
|
|
36820
|
-
return closestPoint;
|
|
36821
|
-
}
|
|
36822
36808
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
36823
36809
|
let closestPoint = null;
|
|
36824
36810
|
let minDistance = Infinity;
|
|
@@ -36837,7 +36823,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
36837
36823
|
return closestPoint;
|
|
36838
36824
|
}
|
|
36839
36825
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36840
|
-
const tempGridInfo = createGrid(start, end);
|
|
36826
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
36841
36827
|
const startPoint = tempGridInfo.newStart || start;
|
|
36842
36828
|
const endPoint = tempGridInfo.newEnd || end;
|
|
36843
36829
|
const startDir = getPointerDirection(start);
|
|
@@ -36847,11 +36833,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36847
36833
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
36848
36834
|
const finalStart = newStart || start;
|
|
36849
36835
|
const finalEnd = newEnd || end;
|
|
36850
|
-
const
|
|
36851
|
-
const
|
|
36852
|
-
|
|
36853
|
-
|
|
36854
|
-
|
|
36836
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
36837
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
36838
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
36839
|
+
return { lines: [], newStart, newEnd };
|
|
36840
|
+
}
|
|
36841
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
36855
36842
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
36856
36843
|
acc.push(p3);
|
|
36857
36844
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -39273,20 +39273,6 @@ function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
|
39273
39273
|
}
|
|
39274
39274
|
return [];
|
|
39275
39275
|
}
|
|
39276
|
-
function findClosestPointInGrid(point5, grid) {
|
|
39277
|
-
let closestPoint = grid[0][0];
|
|
39278
|
-
let minDistance = Infinity;
|
|
39279
|
-
for (const row2 of grid) {
|
|
39280
|
-
for (const gridPoint of row2) {
|
|
39281
|
-
const distance = Math.abs(point5.x - gridPoint.x) + Math.abs(point5.y - gridPoint.y);
|
|
39282
|
-
if (distance < minDistance) {
|
|
39283
|
-
minDistance = distance;
|
|
39284
|
-
closestPoint = gridPoint;
|
|
39285
|
-
}
|
|
39286
|
-
}
|
|
39287
|
-
}
|
|
39288
|
-
return closestPoint;
|
|
39289
|
-
}
|
|
39290
39276
|
function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
39291
39277
|
let closestPoint = null;
|
|
39292
39278
|
let minDistance = Infinity;
|
|
@@ -39305,7 +39291,7 @@ function findClosestValidPointInGrid(point5, grid, obstacles) {
|
|
|
39305
39291
|
return closestPoint;
|
|
39306
39292
|
}
|
|
39307
39293
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
39308
|
-
const tempGridInfo = createGrid(start, end);
|
|
39294
|
+
const tempGridInfo = createGrid(start, end, toVisitPoints);
|
|
39309
39295
|
const startPoint = tempGridInfo.newStart || start;
|
|
39310
39296
|
const endPoint = tempGridInfo.newEnd || end;
|
|
39311
39297
|
const startDir = getPointerDirection(start);
|
|
@@ -39315,11 +39301,12 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39315
39301
|
const { grid, newStart, newEnd } = createGrid(start, end, allWaypoints);
|
|
39316
39302
|
const finalStart = newStart || start;
|
|
39317
39303
|
const finalEnd = newEnd || end;
|
|
39318
|
-
const
|
|
39319
|
-
const
|
|
39320
|
-
|
|
39321
|
-
|
|
39322
|
-
|
|
39304
|
+
const pointsToSnap = [finalStart, ...allWaypoints, finalEnd];
|
|
39305
|
+
const snappedAndValidatedPoints = pointsToSnap.map((p3) => findClosestValidPointInGrid(p3, grid, obstacles)).filter((p3) => p3 !== null);
|
|
39306
|
+
if (snappedAndValidatedPoints.length < 2) {
|
|
39307
|
+
return { lines: [], newStart, newEnd };
|
|
39308
|
+
}
|
|
39309
|
+
const uniquePoints = snappedAndValidatedPoints.reduce((acc, p3) => {
|
|
39323
39310
|
if (!acc.some((existing) => existing.barelyEqual(p3))) {
|
|
39324
39311
|
acc.push(p3);
|
|
39325
39312
|
}
|