microboard-temp 0.5.79 → 0.5.80
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 +48 -16
- package/dist/cjs/index.js +48 -16
- package/dist/cjs/node.js +48 -16
- package/dist/esm/browser.js +48 -16
- package/dist/esm/index.js +48 -16
- package/dist/esm/node.js +48 -16
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36934,33 +36934,65 @@ function reconstructPath(node2) {
|
|
|
36934
36934
|
}
|
|
36935
36935
|
return path2.reverse();
|
|
36936
36936
|
}
|
|
36937
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36938
|
-
|
|
36937
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
36938
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
36939
|
+
return [];
|
|
36940
|
+
}
|
|
36941
|
+
const startMbr = start.item.getMbr();
|
|
36942
|
+
const endMbr = end.item.getMbr();
|
|
36939
36943
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36940
36944
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36941
|
-
|
|
36942
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36943
|
-
return hookPoints;
|
|
36945
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36944
36946
|
}
|
|
36945
36947
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36946
36948
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36947
|
-
|
|
36948
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36949
|
-
return hookPoints;
|
|
36949
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36950
36950
|
}
|
|
36951
36951
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36952
36952
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36953
|
-
|
|
36954
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
36955
|
-
return hookPoints;
|
|
36953
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36956
36954
|
}
|
|
36957
36955
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36958
36956
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36959
|
-
|
|
36960
|
-
|
|
36961
|
-
|
|
36957
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36958
|
+
}
|
|
36959
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
36960
|
+
let needsHook = false;
|
|
36961
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
36962
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36963
|
+
needsHook = true;
|
|
36964
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36965
|
+
needsHook = true;
|
|
36966
|
+
}
|
|
36967
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
36968
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36969
|
+
needsHook = true;
|
|
36970
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36971
|
+
needsHook = true;
|
|
36972
|
+
}
|
|
36973
|
+
if (needsHook) {
|
|
36974
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
36975
|
+
}
|
|
36962
36976
|
}
|
|
36963
|
-
|
|
36977
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
36978
|
+
let needsHook = false;
|
|
36979
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
36980
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36981
|
+
needsHook = true;
|
|
36982
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36983
|
+
needsHook = true;
|
|
36984
|
+
}
|
|
36985
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
36986
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36987
|
+
needsHook = true;
|
|
36988
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36989
|
+
needsHook = true;
|
|
36990
|
+
}
|
|
36991
|
+
if (needsHook) {
|
|
36992
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
36993
|
+
}
|
|
36994
|
+
}
|
|
36995
|
+
return [];
|
|
36964
36996
|
}
|
|
36965
36997
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36966
36998
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -36968,7 +37000,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36968
37000
|
const endPoint = newEnd || end;
|
|
36969
37001
|
const startDir = getPointerDirection(start);
|
|
36970
37002
|
const endDir = getPointerDirection(end);
|
|
36971
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
37003
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
36972
37004
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36973
37005
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36974
37006
|
return {
|
package/dist/cjs/index.js
CHANGED
|
@@ -36934,33 +36934,65 @@ function reconstructPath(node2) {
|
|
|
36934
36934
|
}
|
|
36935
36935
|
return path2.reverse();
|
|
36936
36936
|
}
|
|
36937
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36938
|
-
|
|
36937
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
36938
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
36939
|
+
return [];
|
|
36940
|
+
}
|
|
36941
|
+
const startMbr = start.item.getMbr();
|
|
36942
|
+
const endMbr = end.item.getMbr();
|
|
36939
36943
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36940
36944
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36941
|
-
|
|
36942
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36943
|
-
return hookPoints;
|
|
36945
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36944
36946
|
}
|
|
36945
36947
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36946
36948
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36947
|
-
|
|
36948
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36949
|
-
return hookPoints;
|
|
36949
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36950
36950
|
}
|
|
36951
36951
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36952
36952
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36953
|
-
|
|
36954
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
36955
|
-
return hookPoints;
|
|
36953
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36956
36954
|
}
|
|
36957
36955
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36958
36956
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36959
|
-
|
|
36960
|
-
|
|
36961
|
-
|
|
36957
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36958
|
+
}
|
|
36959
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
36960
|
+
let needsHook = false;
|
|
36961
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
36962
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36963
|
+
needsHook = true;
|
|
36964
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36965
|
+
needsHook = true;
|
|
36966
|
+
}
|
|
36967
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
36968
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36969
|
+
needsHook = true;
|
|
36970
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36971
|
+
needsHook = true;
|
|
36972
|
+
}
|
|
36973
|
+
if (needsHook) {
|
|
36974
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
36975
|
+
}
|
|
36962
36976
|
}
|
|
36963
|
-
|
|
36977
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
36978
|
+
let needsHook = false;
|
|
36979
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
36980
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36981
|
+
needsHook = true;
|
|
36982
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36983
|
+
needsHook = true;
|
|
36984
|
+
}
|
|
36985
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
36986
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36987
|
+
needsHook = true;
|
|
36988
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36989
|
+
needsHook = true;
|
|
36990
|
+
}
|
|
36991
|
+
if (needsHook) {
|
|
36992
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
36993
|
+
}
|
|
36994
|
+
}
|
|
36995
|
+
return [];
|
|
36964
36996
|
}
|
|
36965
36997
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36966
36998
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -36968,7 +37000,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36968
37000
|
const endPoint = newEnd || end;
|
|
36969
37001
|
const startDir = getPointerDirection(start);
|
|
36970
37002
|
const endDir = getPointerDirection(end);
|
|
36971
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
37003
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
36972
37004
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36973
37005
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36974
37006
|
return {
|
package/dist/cjs/node.js
CHANGED
|
@@ -39407,33 +39407,65 @@ function reconstructPath(node2) {
|
|
|
39407
39407
|
}
|
|
39408
39408
|
return path2.reverse();
|
|
39409
39409
|
}
|
|
39410
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
39411
|
-
|
|
39410
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
39411
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
39412
|
+
return [];
|
|
39413
|
+
}
|
|
39414
|
+
const startMbr = start.item.getMbr();
|
|
39415
|
+
const endMbr = end.item.getMbr();
|
|
39412
39416
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
39413
39417
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39414
|
-
|
|
39415
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
39416
|
-
return hookPoints;
|
|
39418
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39417
39419
|
}
|
|
39418
39420
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
39419
39421
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39420
|
-
|
|
39421
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
39422
|
-
return hookPoints;
|
|
39422
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39423
39423
|
}
|
|
39424
39424
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
39425
39425
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39426
|
-
|
|
39427
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
39428
|
-
return hookPoints;
|
|
39426
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39429
39427
|
}
|
|
39430
39428
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
39431
39429
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39432
|
-
|
|
39433
|
-
|
|
39434
|
-
|
|
39430
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39431
|
+
}
|
|
39432
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
39433
|
+
let needsHook = false;
|
|
39434
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
39435
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
39436
|
+
needsHook = true;
|
|
39437
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
39438
|
+
needsHook = true;
|
|
39439
|
+
}
|
|
39440
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
39441
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
39442
|
+
needsHook = true;
|
|
39443
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
39444
|
+
needsHook = true;
|
|
39445
|
+
}
|
|
39446
|
+
if (needsHook) {
|
|
39447
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
39448
|
+
}
|
|
39435
39449
|
}
|
|
39436
|
-
|
|
39450
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
39451
|
+
let needsHook = false;
|
|
39452
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
39453
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
39454
|
+
needsHook = true;
|
|
39455
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
39456
|
+
needsHook = true;
|
|
39457
|
+
}
|
|
39458
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
39459
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
39460
|
+
needsHook = true;
|
|
39461
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
39462
|
+
needsHook = true;
|
|
39463
|
+
}
|
|
39464
|
+
if (needsHook) {
|
|
39465
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
39466
|
+
}
|
|
39467
|
+
}
|
|
39468
|
+
return [];
|
|
39437
39469
|
}
|
|
39438
39470
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
39439
39471
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -39441,7 +39473,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39441
39473
|
const endPoint = newEnd || end;
|
|
39442
39474
|
const startDir = getPointerDirection(start);
|
|
39443
39475
|
const endDir = getPointerDirection(end);
|
|
39444
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
39476
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
39445
39477
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
39446
39478
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
39447
39479
|
return {
|
package/dist/esm/browser.js
CHANGED
|
@@ -36779,33 +36779,65 @@ function reconstructPath(node2) {
|
|
|
36779
36779
|
}
|
|
36780
36780
|
return path2.reverse();
|
|
36781
36781
|
}
|
|
36782
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36783
|
-
|
|
36782
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
36783
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
36784
|
+
return [];
|
|
36785
|
+
}
|
|
36786
|
+
const startMbr = start.item.getMbr();
|
|
36787
|
+
const endMbr = end.item.getMbr();
|
|
36784
36788
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36785
36789
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36786
|
-
|
|
36787
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36788
|
-
return hookPoints;
|
|
36790
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36789
36791
|
}
|
|
36790
36792
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36791
36793
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36792
|
-
|
|
36793
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36794
|
-
return hookPoints;
|
|
36794
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36795
36795
|
}
|
|
36796
36796
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36797
36797
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36798
|
-
|
|
36799
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
36800
|
-
return hookPoints;
|
|
36798
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36801
36799
|
}
|
|
36802
36800
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36803
36801
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36804
|
-
|
|
36805
|
-
|
|
36806
|
-
|
|
36802
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36803
|
+
}
|
|
36804
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
36805
|
+
let needsHook = false;
|
|
36806
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
36807
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36808
|
+
needsHook = true;
|
|
36809
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36810
|
+
needsHook = true;
|
|
36811
|
+
}
|
|
36812
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
36813
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36814
|
+
needsHook = true;
|
|
36815
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36816
|
+
needsHook = true;
|
|
36817
|
+
}
|
|
36818
|
+
if (needsHook) {
|
|
36819
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
36820
|
+
}
|
|
36807
36821
|
}
|
|
36808
|
-
|
|
36822
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
36823
|
+
let needsHook = false;
|
|
36824
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
36825
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36826
|
+
needsHook = true;
|
|
36827
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36828
|
+
needsHook = true;
|
|
36829
|
+
}
|
|
36830
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
36831
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36832
|
+
needsHook = true;
|
|
36833
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36834
|
+
needsHook = true;
|
|
36835
|
+
}
|
|
36836
|
+
if (needsHook) {
|
|
36837
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
36838
|
+
}
|
|
36839
|
+
}
|
|
36840
|
+
return [];
|
|
36809
36841
|
}
|
|
36810
36842
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36811
36843
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -36813,7 +36845,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36813
36845
|
const endPoint = newEnd || end;
|
|
36814
36846
|
const startDir = getPointerDirection(start);
|
|
36815
36847
|
const endDir = getPointerDirection(end);
|
|
36816
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
36848
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
36817
36849
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36818
36850
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36819
36851
|
return {
|
package/dist/esm/index.js
CHANGED
|
@@ -36772,33 +36772,65 @@ function reconstructPath(node2) {
|
|
|
36772
36772
|
}
|
|
36773
36773
|
return path2.reverse();
|
|
36774
36774
|
}
|
|
36775
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
36776
|
-
|
|
36775
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
36776
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
36777
|
+
return [];
|
|
36778
|
+
}
|
|
36779
|
+
const startMbr = start.item.getMbr();
|
|
36780
|
+
const endMbr = end.item.getMbr();
|
|
36777
36781
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
36778
36782
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36779
|
-
|
|
36780
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36781
|
-
return hookPoints;
|
|
36783
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36782
36784
|
}
|
|
36783
36785
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36784
36786
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36785
|
-
|
|
36786
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
36787
|
-
return hookPoints;
|
|
36787
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36788
36788
|
}
|
|
36789
36789
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36790
36790
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36791
|
-
|
|
36792
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
36793
|
-
return hookPoints;
|
|
36791
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36794
36792
|
}
|
|
36795
36793
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36796
36794
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36797
|
-
|
|
36798
|
-
|
|
36799
|
-
|
|
36795
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36796
|
+
}
|
|
36797
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
36798
|
+
let needsHook = false;
|
|
36799
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
36800
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36801
|
+
needsHook = true;
|
|
36802
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36803
|
+
needsHook = true;
|
|
36804
|
+
}
|
|
36805
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
36806
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
36807
|
+
needsHook = true;
|
|
36808
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
36809
|
+
needsHook = true;
|
|
36810
|
+
}
|
|
36811
|
+
if (needsHook) {
|
|
36812
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
36813
|
+
}
|
|
36800
36814
|
}
|
|
36801
|
-
|
|
36815
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
36816
|
+
let needsHook = false;
|
|
36817
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
36818
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36819
|
+
needsHook = true;
|
|
36820
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36821
|
+
needsHook = true;
|
|
36822
|
+
}
|
|
36823
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
36824
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
36825
|
+
needsHook = true;
|
|
36826
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
36827
|
+
needsHook = true;
|
|
36828
|
+
}
|
|
36829
|
+
if (needsHook) {
|
|
36830
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
36831
|
+
}
|
|
36832
|
+
}
|
|
36833
|
+
return [];
|
|
36802
36834
|
}
|
|
36803
36835
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
36804
36836
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -36806,7 +36838,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36806
36838
|
const endPoint = newEnd || end;
|
|
36807
36839
|
const startDir = getPointerDirection(start);
|
|
36808
36840
|
const endDir = getPointerDirection(end);
|
|
36809
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
36841
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
36810
36842
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36811
36843
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36812
36844
|
return {
|
package/dist/esm/node.js
CHANGED
|
@@ -39240,33 +39240,65 @@ function reconstructPath(node2) {
|
|
|
39240
39240
|
}
|
|
39241
39241
|
return path2.reverse();
|
|
39242
39242
|
}
|
|
39243
|
-
function createHookWaypoints(startPoint, endPoint, startDir, endDir) {
|
|
39244
|
-
|
|
39243
|
+
function createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir) {
|
|
39244
|
+
if (!startDir || !endDir || start.pointType === "Board" || end.pointType === "Board") {
|
|
39245
|
+
return [];
|
|
39246
|
+
}
|
|
39247
|
+
const startMbr = start.item.getMbr();
|
|
39248
|
+
const endMbr = end.item.getMbr();
|
|
39245
39249
|
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x) {
|
|
39246
39250
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39247
|
-
|
|
39248
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
39249
|
-
return hookPoints;
|
|
39251
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39250
39252
|
}
|
|
39251
39253
|
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
39252
39254
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39253
|
-
|
|
39254
|
-
hookPoints.push(new Point(endPoint.x, midY));
|
|
39255
|
-
return hookPoints;
|
|
39255
|
+
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39256
39256
|
}
|
|
39257
39257
|
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
39258
39258
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39259
|
-
|
|
39260
|
-
hookPoints.push(new Point(midX, endPoint.y));
|
|
39261
|
-
return hookPoints;
|
|
39259
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39262
39260
|
}
|
|
39263
39261
|
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
39264
39262
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39265
|
-
|
|
39266
|
-
|
|
39267
|
-
|
|
39263
|
+
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39264
|
+
}
|
|
39265
|
+
if ((startDir === "right" || startDir === "left") && (endDir === "top" || endDir === "bottom")) {
|
|
39266
|
+
let needsHook = false;
|
|
39267
|
+
if (startDir === "right" && startPoint.x > endMbr.right) {
|
|
39268
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
39269
|
+
needsHook = true;
|
|
39270
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
39271
|
+
needsHook = true;
|
|
39272
|
+
}
|
|
39273
|
+
if (startDir === "left" && startPoint.x < endMbr.left) {
|
|
39274
|
+
if (endDir === "top" && endPoint.y < startMbr.top)
|
|
39275
|
+
needsHook = true;
|
|
39276
|
+
if (endDir === "bottom" && endPoint.y > startMbr.bottom)
|
|
39277
|
+
needsHook = true;
|
|
39278
|
+
}
|
|
39279
|
+
if (needsHook) {
|
|
39280
|
+
return [new Point(endPoint.x, startPoint.y)];
|
|
39281
|
+
}
|
|
39268
39282
|
}
|
|
39269
|
-
|
|
39283
|
+
if ((startDir === "top" || startDir === "bottom") && (endDir === "right" || endDir === "left")) {
|
|
39284
|
+
let needsHook = false;
|
|
39285
|
+
if (startDir === "top" && startPoint.y < endMbr.top) {
|
|
39286
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
39287
|
+
needsHook = true;
|
|
39288
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
39289
|
+
needsHook = true;
|
|
39290
|
+
}
|
|
39291
|
+
if (startDir === "bottom" && startPoint.y > endMbr.bottom) {
|
|
39292
|
+
if (endDir === "right" && endPoint.x > startMbr.right)
|
|
39293
|
+
needsHook = true;
|
|
39294
|
+
if (endDir === "left" && endPoint.x < startMbr.left)
|
|
39295
|
+
needsHook = true;
|
|
39296
|
+
}
|
|
39297
|
+
if (needsHook) {
|
|
39298
|
+
return [new Point(startPoint.x, endPoint.y)];
|
|
39299
|
+
}
|
|
39300
|
+
}
|
|
39301
|
+
return [];
|
|
39270
39302
|
}
|
|
39271
39303
|
function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
39272
39304
|
const { grid, newStart, newEnd } = createGrid(start, end, toVisitPoints);
|
|
@@ -39274,7 +39306,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39274
39306
|
const endPoint = newEnd || end;
|
|
39275
39307
|
const startDir = getPointerDirection(start);
|
|
39276
39308
|
const endDir = getPointerDirection(end);
|
|
39277
|
-
const hookWaypoints = createHookWaypoints(startPoint, endPoint, startDir, endDir);
|
|
39309
|
+
const hookWaypoints = createHookWaypoints(startPoint, endPoint, start, end, startDir, endDir);
|
|
39278
39310
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
39279
39311
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
39280
39312
|
return {
|