microboard-temp 0.5.85 → 0.5.87
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 +19 -10
- package/dist/cjs/index.js +19 -10
- package/dist/cjs/node.js +19 -10
- package/dist/esm/browser.js +19 -10
- package/dist/esm/index.js +19 -10
- package/dist/esm/node.js +19 -10
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36934,29 +36934,35 @@ function reconstructPath(node2) {
|
|
|
36934
36934
|
}
|
|
36935
36935
|
return path2.reverse();
|
|
36936
36936
|
}
|
|
36937
|
-
function
|
|
36938
|
-
|
|
36937
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36938
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
36939
|
+
}
|
|
36940
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36941
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
36942
|
+
}
|
|
36943
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
36944
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36939
36945
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36940
36946
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36941
36947
|
}
|
|
36942
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36948
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36943
36949
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36944
36950
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36945
36951
|
}
|
|
36946
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36952
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36947
36953
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36948
36954
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36949
36955
|
}
|
|
36950
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36956
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36951
36957
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36952
36958
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36953
36959
|
}
|
|
36954
36960
|
const dx = endPoint.x - startPoint.x;
|
|
36955
36961
|
const dy = endPoint.y - startPoint.y;
|
|
36956
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
36957
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
36958
|
-
const endConflictX = endDir === "right" && dx
|
|
36959
|
-
const endConflictY = endDir === "bottom" && dy
|
|
36962
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36963
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36964
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36965
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36960
36966
|
if (startConflictX || endConflictY) {
|
|
36961
36967
|
return [new Point(startPoint.x, endPoint.y)];
|
|
36962
36968
|
}
|
|
@@ -36971,7 +36977,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36971
36977
|
const endPoint = newEnd || end;
|
|
36972
36978
|
const startDir = getPointerDirection(start);
|
|
36973
36979
|
const endDir = getPointerDirection(end);
|
|
36974
|
-
|
|
36980
|
+
let hookWaypoints = [];
|
|
36981
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
36982
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
36983
|
+
}
|
|
36975
36984
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36976
36985
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36977
36986
|
return {
|
package/dist/cjs/index.js
CHANGED
|
@@ -36934,29 +36934,35 @@ function reconstructPath(node2) {
|
|
|
36934
36934
|
}
|
|
36935
36935
|
return path2.reverse();
|
|
36936
36936
|
}
|
|
36937
|
-
function
|
|
36938
|
-
|
|
36937
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36938
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
36939
|
+
}
|
|
36940
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36941
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
36942
|
+
}
|
|
36943
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
36944
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36939
36945
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36940
36946
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36941
36947
|
}
|
|
36942
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36948
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36943
36949
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36944
36950
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36945
36951
|
}
|
|
36946
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36952
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36947
36953
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36948
36954
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36949
36955
|
}
|
|
36950
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36956
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36951
36957
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36952
36958
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36953
36959
|
}
|
|
36954
36960
|
const dx = endPoint.x - startPoint.x;
|
|
36955
36961
|
const dy = endPoint.y - startPoint.y;
|
|
36956
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
36957
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
36958
|
-
const endConflictX = endDir === "right" && dx
|
|
36959
|
-
const endConflictY = endDir === "bottom" && dy
|
|
36962
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36963
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36964
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36965
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36960
36966
|
if (startConflictX || endConflictY) {
|
|
36961
36967
|
return [new Point(startPoint.x, endPoint.y)];
|
|
36962
36968
|
}
|
|
@@ -36971,7 +36977,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36971
36977
|
const endPoint = newEnd || end;
|
|
36972
36978
|
const startDir = getPointerDirection(start);
|
|
36973
36979
|
const endDir = getPointerDirection(end);
|
|
36974
|
-
|
|
36980
|
+
let hookWaypoints = [];
|
|
36981
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
36982
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
36983
|
+
}
|
|
36975
36984
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36976
36985
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36977
36986
|
return {
|
package/dist/cjs/node.js
CHANGED
|
@@ -39407,29 +39407,35 @@ function reconstructPath(node2) {
|
|
|
39407
39407
|
}
|
|
39408
39408
|
return path2.reverse();
|
|
39409
39409
|
}
|
|
39410
|
-
function
|
|
39411
|
-
|
|
39410
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
39411
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
39412
|
+
}
|
|
39413
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
39414
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
39415
|
+
}
|
|
39416
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
39417
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39412
39418
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39413
39419
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39414
39420
|
}
|
|
39415
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
39421
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39416
39422
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39417
39423
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39418
39424
|
}
|
|
39419
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
39425
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39420
39426
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39421
39427
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39422
39428
|
}
|
|
39423
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
39429
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39424
39430
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39425
39431
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39426
39432
|
}
|
|
39427
39433
|
const dx = endPoint.x - startPoint.x;
|
|
39428
39434
|
const dy = endPoint.y - startPoint.y;
|
|
39429
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
39430
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
39431
|
-
const endConflictX = endDir === "right" && dx
|
|
39432
|
-
const endConflictY = endDir === "bottom" && dy
|
|
39435
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39436
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39437
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39438
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39433
39439
|
if (startConflictX || endConflictY) {
|
|
39434
39440
|
return [new Point(startPoint.x, endPoint.y)];
|
|
39435
39441
|
}
|
|
@@ -39444,7 +39450,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39444
39450
|
const endPoint = newEnd || end;
|
|
39445
39451
|
const startDir = getPointerDirection(start);
|
|
39446
39452
|
const endDir = getPointerDirection(end);
|
|
39447
|
-
|
|
39453
|
+
let hookWaypoints = [];
|
|
39454
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
39455
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
39456
|
+
}
|
|
39448
39457
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
39449
39458
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
39450
39459
|
return {
|
package/dist/esm/browser.js
CHANGED
|
@@ -36779,29 +36779,35 @@ function reconstructPath(node2) {
|
|
|
36779
36779
|
}
|
|
36780
36780
|
return path2.reverse();
|
|
36781
36781
|
}
|
|
36782
|
-
function
|
|
36783
|
-
|
|
36782
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36783
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
36784
|
+
}
|
|
36785
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36786
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
36787
|
+
}
|
|
36788
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
36789
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36784
36790
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36785
36791
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36786
36792
|
}
|
|
36787
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36793
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36788
36794
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36789
36795
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36790
36796
|
}
|
|
36791
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36797
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36792
36798
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36793
36799
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36794
36800
|
}
|
|
36795
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36801
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36796
36802
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36797
36803
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36798
36804
|
}
|
|
36799
36805
|
const dx = endPoint.x - startPoint.x;
|
|
36800
36806
|
const dy = endPoint.y - startPoint.y;
|
|
36801
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
36802
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
36803
|
-
const endConflictX = endDir === "right" && dx
|
|
36804
|
-
const endConflictY = endDir === "bottom" && dy
|
|
36807
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36808
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36809
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36810
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36805
36811
|
if (startConflictX || endConflictY) {
|
|
36806
36812
|
return [new Point(startPoint.x, endPoint.y)];
|
|
36807
36813
|
}
|
|
@@ -36816,7 +36822,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36816
36822
|
const endPoint = newEnd || end;
|
|
36817
36823
|
const startDir = getPointerDirection(start);
|
|
36818
36824
|
const endDir = getPointerDirection(end);
|
|
36819
|
-
|
|
36825
|
+
let hookWaypoints = [];
|
|
36826
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
36827
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
36828
|
+
}
|
|
36820
36829
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36821
36830
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36822
36831
|
return {
|
package/dist/esm/index.js
CHANGED
|
@@ -36772,29 +36772,35 @@ function reconstructPath(node2) {
|
|
|
36772
36772
|
}
|
|
36773
36773
|
return path2.reverse();
|
|
36774
36774
|
}
|
|
36775
|
-
function
|
|
36776
|
-
|
|
36775
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36776
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
36777
|
+
}
|
|
36778
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
36779
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
36780
|
+
}
|
|
36781
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
36782
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36777
36783
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36778
36784
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36779
36785
|
}
|
|
36780
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
36786
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36781
36787
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
36782
36788
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
36783
36789
|
}
|
|
36784
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
36790
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36785
36791
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36786
36792
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36787
36793
|
}
|
|
36788
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
36794
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
36789
36795
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
36790
36796
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
36791
36797
|
}
|
|
36792
36798
|
const dx = endPoint.x - startPoint.x;
|
|
36793
36799
|
const dy = endPoint.y - startPoint.y;
|
|
36794
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
36795
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
36796
|
-
const endConflictX = endDir === "right" && dx
|
|
36797
|
-
const endConflictY = endDir === "bottom" && dy
|
|
36800
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36801
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36802
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36803
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
36798
36804
|
if (startConflictX || endConflictY) {
|
|
36799
36805
|
return [new Point(startPoint.x, endPoint.y)];
|
|
36800
36806
|
}
|
|
@@ -36809,7 +36815,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
36809
36815
|
const endPoint = newEnd || end;
|
|
36810
36816
|
const startDir = getPointerDirection(start);
|
|
36811
36817
|
const endDir = getPointerDirection(end);
|
|
36812
|
-
|
|
36818
|
+
let hookWaypoints = [];
|
|
36819
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
36820
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
36821
|
+
}
|
|
36813
36822
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
36814
36823
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
36815
36824
|
return {
|
package/dist/esm/node.js
CHANGED
|
@@ -39240,29 +39240,35 @@ function reconstructPath(node2) {
|
|
|
39240
39240
|
}
|
|
39241
39241
|
return path2.reverse();
|
|
39242
39242
|
}
|
|
39243
|
-
function
|
|
39244
|
-
|
|
39243
|
+
function haveVerticalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
39244
|
+
return firstMbr.top >= secondMbr.bottom - offset && secondMbr.top >= firstMbr.bottom - offset;
|
|
39245
|
+
}
|
|
39246
|
+
function haveHorizontalIntersection(firstMbr, secondMbr, offset = 0) {
|
|
39247
|
+
return firstMbr.right >= secondMbr.left - offset && secondMbr.right >= firstMbr.left - offset;
|
|
39248
|
+
}
|
|
39249
|
+
function createHookWaypoints(startPoint, endPoint, startItemMbr, endItemMbr, startDir, endDir) {
|
|
39250
|
+
if (startDir === "right" && endDir === "left" && startPoint.x > endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39245
39251
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39246
39252
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39247
39253
|
}
|
|
39248
|
-
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x) {
|
|
39254
|
+
if (startDir === "left" && endDir === "right" && startPoint.x < endPoint.x && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39249
39255
|
const midY = (startPoint.y + endPoint.y) / 2;
|
|
39250
39256
|
return [new Point(startPoint.x, midY), new Point(endPoint.x, midY)];
|
|
39251
39257
|
}
|
|
39252
|
-
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y) {
|
|
39258
|
+
if (startDir === "bottom" && endDir === "top" && startPoint.y > endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39253
39259
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39254
39260
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39255
39261
|
}
|
|
39256
|
-
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y) {
|
|
39262
|
+
if (startDir === "top" && endDir === "bottom" && startPoint.y < endPoint.y && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2)) {
|
|
39257
39263
|
const midX = (startPoint.x + endPoint.x) / 2;
|
|
39258
39264
|
return [new Point(midX, startPoint.y), new Point(midX, endPoint.y)];
|
|
39259
39265
|
}
|
|
39260
39266
|
const dx = endPoint.x - startPoint.x;
|
|
39261
39267
|
const dy = endPoint.y - startPoint.y;
|
|
39262
|
-
const startConflictX = startDir === "right" && dx < 0 || startDir === "left" && dx > 0;
|
|
39263
|
-
const startConflictY = startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0;
|
|
39264
|
-
const endConflictX = endDir === "right" && dx
|
|
39265
|
-
const endConflictY = endDir === "bottom" && dy
|
|
39268
|
+
const startConflictX = (startDir === "right" && dx < 0 || startDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39269
|
+
const startConflictY = (startDir === "bottom" && dy < 0 || startDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39270
|
+
const endConflictX = (endDir === "right" && dx < 0 || endDir === "left" && dx > 0) && !haveVerticalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39271
|
+
const endConflictY = (endDir === "bottom" && dy < 0 || endDir === "top" && dy > 0) && !haveHorizontalIntersection(startItemMbr, endItemMbr, conf.CONNECTOR_ITEM_OFFSET * 2);
|
|
39266
39272
|
if (startConflictX || endConflictY) {
|
|
39267
39273
|
return [new Point(startPoint.x, endPoint.y)];
|
|
39268
39274
|
}
|
|
@@ -39277,7 +39283,10 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
|
|
|
39277
39283
|
const endPoint = newEnd || end;
|
|
39278
39284
|
const startDir = getPointerDirection(start);
|
|
39279
39285
|
const endDir = getPointerDirection(end);
|
|
39280
|
-
|
|
39286
|
+
let hookWaypoints = [];
|
|
39287
|
+
if (startPoint.pointType !== "Board" && endPoint.pointType !== "Board") {
|
|
39288
|
+
hookWaypoints = createHookWaypoints(startPoint, endPoint, startPoint.item.getMbr(), endPoint.item.getMbr(), startDir, endDir);
|
|
39289
|
+
}
|
|
39281
39290
|
const points = [startPoint, ...hookWaypoints, ...toVisitPoints, endPoint];
|
|
39282
39291
|
const pathPoints = findPathPoints(points, grid, obstacles, newStart, newEnd);
|
|
39283
39292
|
return {
|