microboard-temp 0.5.74 → 0.5.75
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 +46 -21
- package/dist/cjs/index.js +46 -21
- package/dist/cjs/node.js +46 -21
- package/dist/esm/browser.js +46 -21
- package/dist/esm/index.js +46 -21
- package/dist/esm/node.js +46 -21
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -36767,26 +36767,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36767
36767
|
};
|
|
36768
36768
|
const horizontalLines = [];
|
|
36769
36769
|
const verticalLines = [];
|
|
36770
|
+
if (start.pointType !== "Board") {
|
|
36771
|
+
const itemMbr = start.item.getMbr();
|
|
36772
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36773
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36774
|
+
}
|
|
36775
|
+
if (end.pointType !== "Board") {
|
|
36776
|
+
const itemMbr = end.item.getMbr();
|
|
36777
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36778
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36779
|
+
}
|
|
36780
|
+
const tempStart = start;
|
|
36781
|
+
const tempEnd = end;
|
|
36782
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
36783
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
36784
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
36785
|
+
toVisitPoints.forEach((p3) => {
|
|
36786
|
+
horizontalLines.push(p3.y);
|
|
36787
|
+
verticalLines.push(p3.x);
|
|
36788
|
+
});
|
|
36789
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36790
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36770
36791
|
let newStart;
|
|
36771
36792
|
let newEnd;
|
|
36772
36793
|
const processPoint = (point5, dir2) => {
|
|
36773
36794
|
const itemMbr = point5.item.getMbr();
|
|
36774
|
-
const
|
|
36775
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36795
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36776
36796
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
36777
|
-
newPoint.x = pointOnMbr.x;
|
|
36778
|
-
newPoint.y = pointOnMbr.y;
|
|
36779
36797
|
if (dir2 === "top") {
|
|
36780
|
-
|
|
36798
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36799
|
+
const nextYIndex = currentYIndex - 1;
|
|
36800
|
+
if (nextYIndex >= 0) {
|
|
36801
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36802
|
+
newPoint.x = pointOnMbr.x;
|
|
36803
|
+
}
|
|
36781
36804
|
} else if (dir2 === "bottom") {
|
|
36782
|
-
|
|
36805
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36806
|
+
const nextYIndex = currentYIndex + 1;
|
|
36807
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
36808
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36809
|
+
newPoint.x = pointOnMbr.x;
|
|
36810
|
+
}
|
|
36783
36811
|
} else if (dir2 === "left") {
|
|
36784
|
-
|
|
36812
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36813
|
+
const nextXIndex = currentXIndex - 1;
|
|
36814
|
+
if (nextXIndex >= 0) {
|
|
36815
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36816
|
+
newPoint.y = pointOnMbr.y;
|
|
36817
|
+
}
|
|
36785
36818
|
} else if (dir2 === "right") {
|
|
36786
|
-
|
|
36819
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36820
|
+
const nextXIndex = currentXIndex + 1;
|
|
36821
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
36822
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36823
|
+
newPoint.y = pointOnMbr.y;
|
|
36824
|
+
}
|
|
36787
36825
|
}
|
|
36788
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
36789
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
36790
36826
|
return newPoint;
|
|
36791
36827
|
};
|
|
36792
36828
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -36795,17 +36831,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36795
36831
|
if (end.pointType !== "Board" && endDir) {
|
|
36796
36832
|
newEnd = processPoint(end, endDir);
|
|
36797
36833
|
}
|
|
36798
|
-
const finalStart = newStart || start;
|
|
36799
|
-
const finalEnd = newEnd || end;
|
|
36800
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
36801
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
36802
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
36803
|
-
toVisitPoints.forEach((p3) => {
|
|
36804
|
-
horizontalLines.push(p3.y);
|
|
36805
|
-
verticalLines.push(p3.x);
|
|
36806
|
-
});
|
|
36807
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36808
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36809
36834
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
36810
36835
|
return {
|
|
36811
36836
|
grid,
|
package/dist/cjs/index.js
CHANGED
|
@@ -36767,26 +36767,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36767
36767
|
};
|
|
36768
36768
|
const horizontalLines = [];
|
|
36769
36769
|
const verticalLines = [];
|
|
36770
|
+
if (start.pointType !== "Board") {
|
|
36771
|
+
const itemMbr = start.item.getMbr();
|
|
36772
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36773
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36774
|
+
}
|
|
36775
|
+
if (end.pointType !== "Board") {
|
|
36776
|
+
const itemMbr = end.item.getMbr();
|
|
36777
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36778
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36779
|
+
}
|
|
36780
|
+
const tempStart = start;
|
|
36781
|
+
const tempEnd = end;
|
|
36782
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
36783
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
36784
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
36785
|
+
toVisitPoints.forEach((p3) => {
|
|
36786
|
+
horizontalLines.push(p3.y);
|
|
36787
|
+
verticalLines.push(p3.x);
|
|
36788
|
+
});
|
|
36789
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36790
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36770
36791
|
let newStart;
|
|
36771
36792
|
let newEnd;
|
|
36772
36793
|
const processPoint = (point5, dir2) => {
|
|
36773
36794
|
const itemMbr = point5.item.getMbr();
|
|
36774
|
-
const
|
|
36775
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36795
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36776
36796
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
36777
|
-
newPoint.x = pointOnMbr.x;
|
|
36778
|
-
newPoint.y = pointOnMbr.y;
|
|
36779
36797
|
if (dir2 === "top") {
|
|
36780
|
-
|
|
36798
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36799
|
+
const nextYIndex = currentYIndex - 1;
|
|
36800
|
+
if (nextYIndex >= 0) {
|
|
36801
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36802
|
+
newPoint.x = pointOnMbr.x;
|
|
36803
|
+
}
|
|
36781
36804
|
} else if (dir2 === "bottom") {
|
|
36782
|
-
|
|
36805
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36806
|
+
const nextYIndex = currentYIndex + 1;
|
|
36807
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
36808
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36809
|
+
newPoint.x = pointOnMbr.x;
|
|
36810
|
+
}
|
|
36783
36811
|
} else if (dir2 === "left") {
|
|
36784
|
-
|
|
36812
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36813
|
+
const nextXIndex = currentXIndex - 1;
|
|
36814
|
+
if (nextXIndex >= 0) {
|
|
36815
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36816
|
+
newPoint.y = pointOnMbr.y;
|
|
36817
|
+
}
|
|
36785
36818
|
} else if (dir2 === "right") {
|
|
36786
|
-
|
|
36819
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36820
|
+
const nextXIndex = currentXIndex + 1;
|
|
36821
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
36822
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36823
|
+
newPoint.y = pointOnMbr.y;
|
|
36824
|
+
}
|
|
36787
36825
|
}
|
|
36788
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
36789
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
36790
36826
|
return newPoint;
|
|
36791
36827
|
};
|
|
36792
36828
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -36795,17 +36831,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36795
36831
|
if (end.pointType !== "Board" && endDir) {
|
|
36796
36832
|
newEnd = processPoint(end, endDir);
|
|
36797
36833
|
}
|
|
36798
|
-
const finalStart = newStart || start;
|
|
36799
|
-
const finalEnd = newEnd || end;
|
|
36800
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
36801
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
36802
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
36803
|
-
toVisitPoints.forEach((p3) => {
|
|
36804
|
-
horizontalLines.push(p3.y);
|
|
36805
|
-
verticalLines.push(p3.x);
|
|
36806
|
-
});
|
|
36807
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36808
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36809
36834
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
36810
36835
|
return {
|
|
36811
36836
|
grid,
|
package/dist/cjs/node.js
CHANGED
|
@@ -39240,26 +39240,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
39240
39240
|
};
|
|
39241
39241
|
const horizontalLines = [];
|
|
39242
39242
|
const verticalLines = [];
|
|
39243
|
+
if (start.pointType !== "Board") {
|
|
39244
|
+
const itemMbr = start.item.getMbr();
|
|
39245
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
39246
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
39247
|
+
}
|
|
39248
|
+
if (end.pointType !== "Board") {
|
|
39249
|
+
const itemMbr = end.item.getMbr();
|
|
39250
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
39251
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
39252
|
+
}
|
|
39253
|
+
const tempStart = start;
|
|
39254
|
+
const tempEnd = end;
|
|
39255
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
39256
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
39257
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
39258
|
+
toVisitPoints.forEach((p3) => {
|
|
39259
|
+
horizontalLines.push(p3.y);
|
|
39260
|
+
verticalLines.push(p3.x);
|
|
39261
|
+
});
|
|
39262
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
39263
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
39243
39264
|
let newStart;
|
|
39244
39265
|
let newEnd;
|
|
39245
39266
|
const processPoint = (point5, dir2) => {
|
|
39246
39267
|
const itemMbr = point5.item.getMbr();
|
|
39247
|
-
const
|
|
39248
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
39268
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
39249
39269
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
39250
|
-
newPoint.x = pointOnMbr.x;
|
|
39251
|
-
newPoint.y = pointOnMbr.y;
|
|
39252
39270
|
if (dir2 === "top") {
|
|
39253
|
-
|
|
39271
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
39272
|
+
const nextYIndex = currentYIndex - 1;
|
|
39273
|
+
if (nextYIndex >= 0) {
|
|
39274
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
39275
|
+
newPoint.x = pointOnMbr.x;
|
|
39276
|
+
}
|
|
39254
39277
|
} else if (dir2 === "bottom") {
|
|
39255
|
-
|
|
39278
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
39279
|
+
const nextYIndex = currentYIndex + 1;
|
|
39280
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
39281
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
39282
|
+
newPoint.x = pointOnMbr.x;
|
|
39283
|
+
}
|
|
39256
39284
|
} else if (dir2 === "left") {
|
|
39257
|
-
|
|
39285
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
39286
|
+
const nextXIndex = currentXIndex - 1;
|
|
39287
|
+
if (nextXIndex >= 0) {
|
|
39288
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
39289
|
+
newPoint.y = pointOnMbr.y;
|
|
39290
|
+
}
|
|
39258
39291
|
} else if (dir2 === "right") {
|
|
39259
|
-
|
|
39292
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
39293
|
+
const nextXIndex = currentXIndex + 1;
|
|
39294
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
39295
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
39296
|
+
newPoint.y = pointOnMbr.y;
|
|
39297
|
+
}
|
|
39260
39298
|
}
|
|
39261
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
39262
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
39263
39299
|
return newPoint;
|
|
39264
39300
|
};
|
|
39265
39301
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -39268,17 +39304,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
39268
39304
|
if (end.pointType !== "Board" && endDir) {
|
|
39269
39305
|
newEnd = processPoint(end, endDir);
|
|
39270
39306
|
}
|
|
39271
|
-
const finalStart = newStart || start;
|
|
39272
|
-
const finalEnd = newEnd || end;
|
|
39273
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
39274
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
39275
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
39276
|
-
toVisitPoints.forEach((p3) => {
|
|
39277
|
-
horizontalLines.push(p3.y);
|
|
39278
|
-
verticalLines.push(p3.x);
|
|
39279
|
-
});
|
|
39280
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
39281
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
39282
39307
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
39283
39308
|
return {
|
|
39284
39309
|
grid,
|
package/dist/esm/browser.js
CHANGED
|
@@ -36612,26 +36612,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36612
36612
|
};
|
|
36613
36613
|
const horizontalLines = [];
|
|
36614
36614
|
const verticalLines = [];
|
|
36615
|
+
if (start.pointType !== "Board") {
|
|
36616
|
+
const itemMbr = start.item.getMbr();
|
|
36617
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36618
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36619
|
+
}
|
|
36620
|
+
if (end.pointType !== "Board") {
|
|
36621
|
+
const itemMbr = end.item.getMbr();
|
|
36622
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36623
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36624
|
+
}
|
|
36625
|
+
const tempStart = start;
|
|
36626
|
+
const tempEnd = end;
|
|
36627
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
36628
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
36629
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
36630
|
+
toVisitPoints.forEach((p3) => {
|
|
36631
|
+
horizontalLines.push(p3.y);
|
|
36632
|
+
verticalLines.push(p3.x);
|
|
36633
|
+
});
|
|
36634
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36635
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36615
36636
|
let newStart;
|
|
36616
36637
|
let newEnd;
|
|
36617
36638
|
const processPoint = (point5, dir2) => {
|
|
36618
36639
|
const itemMbr = point5.item.getMbr();
|
|
36619
|
-
const
|
|
36620
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36640
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36621
36641
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
36622
|
-
newPoint.x = pointOnMbr.x;
|
|
36623
|
-
newPoint.y = pointOnMbr.y;
|
|
36624
36642
|
if (dir2 === "top") {
|
|
36625
|
-
|
|
36643
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36644
|
+
const nextYIndex = currentYIndex - 1;
|
|
36645
|
+
if (nextYIndex >= 0) {
|
|
36646
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36647
|
+
newPoint.x = pointOnMbr.x;
|
|
36648
|
+
}
|
|
36626
36649
|
} else if (dir2 === "bottom") {
|
|
36627
|
-
|
|
36650
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36651
|
+
const nextYIndex = currentYIndex + 1;
|
|
36652
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
36653
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36654
|
+
newPoint.x = pointOnMbr.x;
|
|
36655
|
+
}
|
|
36628
36656
|
} else if (dir2 === "left") {
|
|
36629
|
-
|
|
36657
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36658
|
+
const nextXIndex = currentXIndex - 1;
|
|
36659
|
+
if (nextXIndex >= 0) {
|
|
36660
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36661
|
+
newPoint.y = pointOnMbr.y;
|
|
36662
|
+
}
|
|
36630
36663
|
} else if (dir2 === "right") {
|
|
36631
|
-
|
|
36664
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36665
|
+
const nextXIndex = currentXIndex + 1;
|
|
36666
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
36667
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36668
|
+
newPoint.y = pointOnMbr.y;
|
|
36669
|
+
}
|
|
36632
36670
|
}
|
|
36633
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
36634
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
36635
36671
|
return newPoint;
|
|
36636
36672
|
};
|
|
36637
36673
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -36640,17 +36676,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36640
36676
|
if (end.pointType !== "Board" && endDir) {
|
|
36641
36677
|
newEnd = processPoint(end, endDir);
|
|
36642
36678
|
}
|
|
36643
|
-
const finalStart = newStart || start;
|
|
36644
|
-
const finalEnd = newEnd || end;
|
|
36645
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
36646
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
36647
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
36648
|
-
toVisitPoints.forEach((p3) => {
|
|
36649
|
-
horizontalLines.push(p3.y);
|
|
36650
|
-
verticalLines.push(p3.x);
|
|
36651
|
-
});
|
|
36652
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36653
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36654
36679
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
36655
36680
|
return {
|
|
36656
36681
|
grid,
|
package/dist/esm/index.js
CHANGED
|
@@ -36605,26 +36605,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36605
36605
|
};
|
|
36606
36606
|
const horizontalLines = [];
|
|
36607
36607
|
const verticalLines = [];
|
|
36608
|
+
if (start.pointType !== "Board") {
|
|
36609
|
+
const itemMbr = start.item.getMbr();
|
|
36610
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36611
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36612
|
+
}
|
|
36613
|
+
if (end.pointType !== "Board") {
|
|
36614
|
+
const itemMbr = end.item.getMbr();
|
|
36615
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
36616
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
36617
|
+
}
|
|
36618
|
+
const tempStart = start;
|
|
36619
|
+
const tempEnd = end;
|
|
36620
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
36621
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
36622
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
36623
|
+
toVisitPoints.forEach((p3) => {
|
|
36624
|
+
horizontalLines.push(p3.y);
|
|
36625
|
+
verticalLines.push(p3.x);
|
|
36626
|
+
});
|
|
36627
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36628
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36608
36629
|
let newStart;
|
|
36609
36630
|
let newEnd;
|
|
36610
36631
|
const processPoint = (point5, dir2) => {
|
|
36611
36632
|
const itemMbr = point5.item.getMbr();
|
|
36612
|
-
const
|
|
36613
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36633
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
36614
36634
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
36615
|
-
newPoint.x = pointOnMbr.x;
|
|
36616
|
-
newPoint.y = pointOnMbr.y;
|
|
36617
36635
|
if (dir2 === "top") {
|
|
36618
|
-
|
|
36636
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36637
|
+
const nextYIndex = currentYIndex - 1;
|
|
36638
|
+
if (nextYIndex >= 0) {
|
|
36639
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36640
|
+
newPoint.x = pointOnMbr.x;
|
|
36641
|
+
}
|
|
36619
36642
|
} else if (dir2 === "bottom") {
|
|
36620
|
-
|
|
36643
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
36644
|
+
const nextYIndex = currentYIndex + 1;
|
|
36645
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
36646
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
36647
|
+
newPoint.x = pointOnMbr.x;
|
|
36648
|
+
}
|
|
36621
36649
|
} else if (dir2 === "left") {
|
|
36622
|
-
|
|
36650
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36651
|
+
const nextXIndex = currentXIndex - 1;
|
|
36652
|
+
if (nextXIndex >= 0) {
|
|
36653
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36654
|
+
newPoint.y = pointOnMbr.y;
|
|
36655
|
+
}
|
|
36623
36656
|
} else if (dir2 === "right") {
|
|
36624
|
-
|
|
36657
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
36658
|
+
const nextXIndex = currentXIndex + 1;
|
|
36659
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
36660
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
36661
|
+
newPoint.y = pointOnMbr.y;
|
|
36662
|
+
}
|
|
36625
36663
|
}
|
|
36626
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
36627
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
36628
36664
|
return newPoint;
|
|
36629
36665
|
};
|
|
36630
36666
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -36633,17 +36669,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
36633
36669
|
if (end.pointType !== "Board" && endDir) {
|
|
36634
36670
|
newEnd = processPoint(end, endDir);
|
|
36635
36671
|
}
|
|
36636
|
-
const finalStart = newStart || start;
|
|
36637
|
-
const finalEnd = newEnd || end;
|
|
36638
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
36639
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
36640
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
36641
|
-
toVisitPoints.forEach((p3) => {
|
|
36642
|
-
horizontalLines.push(p3.y);
|
|
36643
|
-
verticalLines.push(p3.x);
|
|
36644
|
-
});
|
|
36645
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
36646
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
36647
36672
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
36648
36673
|
return {
|
|
36649
36674
|
grid,
|
package/dist/esm/node.js
CHANGED
|
@@ -39073,26 +39073,62 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
39073
39073
|
};
|
|
39074
39074
|
const horizontalLines = [];
|
|
39075
39075
|
const verticalLines = [];
|
|
39076
|
+
if (start.pointType !== "Board") {
|
|
39077
|
+
const itemMbr = start.item.getMbr();
|
|
39078
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
39079
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
39080
|
+
}
|
|
39081
|
+
if (end.pointType !== "Board") {
|
|
39082
|
+
const itemMbr = end.item.getMbr();
|
|
39083
|
+
verticalLines.push(itemMbr.left - ITEM_OFFSET, itemMbr.left, itemMbr.right, itemMbr.right + ITEM_OFFSET);
|
|
39084
|
+
horizontalLines.push(itemMbr.top - ITEM_OFFSET, itemMbr.top, itemMbr.bottom, itemMbr.bottom + ITEM_OFFSET);
|
|
39085
|
+
}
|
|
39086
|
+
const tempStart = start;
|
|
39087
|
+
const tempEnd = end;
|
|
39088
|
+
const middle = new Point((tempStart.x + tempEnd.x) / 2, (tempStart.y + tempEnd.y) / 2);
|
|
39089
|
+
horizontalLines.push(middle.y, tempStart.y, tempEnd.y);
|
|
39090
|
+
verticalLines.push(middle.x, tempStart.x, tempEnd.x);
|
|
39091
|
+
toVisitPoints.forEach((p3) => {
|
|
39092
|
+
horizontalLines.push(p3.y);
|
|
39093
|
+
verticalLines.push(p3.x);
|
|
39094
|
+
});
|
|
39095
|
+
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
39096
|
+
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
39076
39097
|
let newStart;
|
|
39077
39098
|
let newEnd;
|
|
39078
39099
|
const processPoint = (point5, dir2) => {
|
|
39079
39100
|
const itemMbr = point5.item.getMbr();
|
|
39080
|
-
const
|
|
39081
|
-
const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
39101
|
+
const pointOnMbr = itemMbr.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
|
|
39082
39102
|
const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
|
|
39083
|
-
newPoint.x = pointOnMbr.x;
|
|
39084
|
-
newPoint.y = pointOnMbr.y;
|
|
39085
39103
|
if (dir2 === "top") {
|
|
39086
|
-
|
|
39104
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
39105
|
+
const nextYIndex = currentYIndex - 1;
|
|
39106
|
+
if (nextYIndex >= 0) {
|
|
39107
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
39108
|
+
newPoint.x = pointOnMbr.x;
|
|
39109
|
+
}
|
|
39087
39110
|
} else if (dir2 === "bottom") {
|
|
39088
|
-
|
|
39111
|
+
const currentYIndex = uniqueHorizontalLines.findIndex((y) => Math.abs(y - pointOnMbr.y) < 0.01);
|
|
39112
|
+
const nextYIndex = currentYIndex + 1;
|
|
39113
|
+
if (nextYIndex < uniqueHorizontalLines.length) {
|
|
39114
|
+
newPoint.y = uniqueHorizontalLines[nextYIndex];
|
|
39115
|
+
newPoint.x = pointOnMbr.x;
|
|
39116
|
+
}
|
|
39089
39117
|
} else if (dir2 === "left") {
|
|
39090
|
-
|
|
39118
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
39119
|
+
const nextXIndex = currentXIndex - 1;
|
|
39120
|
+
if (nextXIndex >= 0) {
|
|
39121
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
39122
|
+
newPoint.y = pointOnMbr.y;
|
|
39123
|
+
}
|
|
39091
39124
|
} else if (dir2 === "right") {
|
|
39092
|
-
|
|
39125
|
+
const currentXIndex = uniqueVerticalLines.findIndex((x) => Math.abs(x - pointOnMbr.x) < 0.01);
|
|
39126
|
+
const nextXIndex = currentXIndex + 1;
|
|
39127
|
+
if (nextXIndex < uniqueVerticalLines.length) {
|
|
39128
|
+
newPoint.x = uniqueVerticalLines[nextXIndex];
|
|
39129
|
+
newPoint.y = pointOnMbr.y;
|
|
39130
|
+
}
|
|
39093
39131
|
}
|
|
39094
|
-
verticalLines.push(mbrFloored.left - ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + ITEM_OFFSET);
|
|
39095
|
-
horizontalLines.push(mbrFloored.top - ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + ITEM_OFFSET);
|
|
39096
39132
|
return newPoint;
|
|
39097
39133
|
};
|
|
39098
39134
|
if (start.pointType !== "Board" && startDir) {
|
|
@@ -39101,17 +39137,6 @@ function createGrid(start, end, toVisitPoints = []) {
|
|
|
39101
39137
|
if (end.pointType !== "Board" && endDir) {
|
|
39102
39138
|
newEnd = processPoint(end, endDir);
|
|
39103
39139
|
}
|
|
39104
|
-
const finalStart = newStart || start;
|
|
39105
|
-
const finalEnd = newEnd || end;
|
|
39106
|
-
const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
|
|
39107
|
-
horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
|
|
39108
|
-
verticalLines.push(middle.x, finalStart.x, finalEnd.x);
|
|
39109
|
-
toVisitPoints.forEach((p3) => {
|
|
39110
|
-
horizontalLines.push(p3.y);
|
|
39111
|
-
verticalLines.push(p3.x);
|
|
39112
|
-
});
|
|
39113
|
-
const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
|
|
39114
|
-
const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
|
|
39115
39140
|
const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
|
|
39116
39141
|
return {
|
|
39117
39142
|
grid,
|