microboard-temp 0.5.82 → 0.5.83

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.
@@ -36731,50 +36731,45 @@ function createGrid(start, end, toVisitPoints = []) {
36731
36731
  const startDir = getPointerDirection(start);
36732
36732
  const endDir = getPointerDirection(end);
36733
36733
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
36734
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
36734
36735
  const offsetMap = {
36735
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
36736
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
36737
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
36738
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
36736
+ top: { x: 0, y: -offset },
36737
+ bottom: { x: 0, y: offset },
36738
+ right: { x: offset, y: 0 },
36739
+ left: { x: -offset, y: 0 }
36739
36740
  };
36740
36741
  const horizontalLines = [];
36741
36742
  const verticalLines = [];
36742
- let newStart;
36743
- let newEnd;
36744
36743
  const processPoint = (point5, dir2) => {
36744
+ if (point5.pointType === "Board")
36745
+ return;
36745
36746
  const itemMbr = point5.item.getMbr();
36746
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
36747
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
36748
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
36749
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
36750
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
36751
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
36752
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
36753
- return newPoint;
36747
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
36748
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
36749
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
36750
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
36754
36751
  };
36755
36752
  if (start.pointType !== "Board" && startDir) {
36756
- newStart = processPoint(start, startDir);
36753
+ processPoint(start, startDir);
36757
36754
  }
36758
36755
  if (end.pointType !== "Board" && endDir) {
36759
- newEnd = processPoint(end, endDir);
36760
- }
36761
- const finalStart = newStart || start;
36762
- const finalEnd = newEnd || end;
36763
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
36764
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
36765
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
36766
- toVisitPoints.forEach((p3) => {
36756
+ processPoint(end, endDir);
36757
+ }
36758
+ const allPoints = [start, end, ...toVisitPoints];
36759
+ allPoints.forEach((p3) => {
36767
36760
  horizontalLines.push(p3.y);
36768
36761
  verticalLines.push(p3.x);
36769
36762
  });
36763
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
36764
+ horizontalLines.push(middle.y);
36765
+ verticalLines.push(middle.x);
36770
36766
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
36771
36767
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
36772
36768
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
36773
36769
  return {
36774
36770
  grid,
36775
- newStart,
36776
- newEnd,
36777
- middlePoint: middle
36771
+ newStart: start,
36772
+ newEnd: end
36778
36773
  };
36779
36774
  }
36780
36775
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -36934,18 +36929,15 @@ function reconstructPath(node2) {
36934
36929
  }
36935
36930
  return path2.reverse();
36936
36931
  }
36937
- function preCalculatePathPoints(start, end) {
36932
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36938
36933
  const startDir = getPointerDirection(start);
36939
36934
  const endDir = getPointerDirection(end);
36940
36935
  const offset = conf.CONNECTOR_ITEM_OFFSET;
36941
36936
  let startPoint = start;
36942
36937
  let endPoint = end;
36943
- const stemWaypoints = [];
36944
- const allWaypoints = [];
36945
36938
  const processPoint = (point5, dir2) => {
36946
- if (point5.pointType === "Board") {
36939
+ if (point5.pointType === "Board")
36947
36940
  return point5;
36948
- }
36949
36941
  const offsetMap = {
36950
36942
  top: { x: 0, y: -offset },
36951
36943
  bottom: { x: 0, y: offset },
@@ -36966,6 +36958,7 @@ function preCalculatePathPoints(start, end) {
36966
36958
  if (end.pointType !== "Board" && endDir) {
36967
36959
  endPoint = processPoint(end, endDir);
36968
36960
  }
36961
+ const stemWaypoints = [];
36969
36962
  if (startDir) {
36970
36963
  let stem;
36971
36964
  if (startDir === "right")
@@ -36977,7 +36970,6 @@ function preCalculatePathPoints(start, end) {
36977
36970
  else
36978
36971
  stem = new Point(startPoint.x, startPoint.y - offset);
36979
36972
  stemWaypoints.push(stem);
36980
- allWaypoints.push(stem);
36981
36973
  }
36982
36974
  if (endDir) {
36983
36975
  let stem;
@@ -36990,14 +36982,9 @@ function preCalculatePathPoints(start, end) {
36990
36982
  else
36991
36983
  stem = new Point(endPoint.x, endPoint.y - offset);
36992
36984
  stemWaypoints.push(stem);
36993
- allWaypoints.push(stem);
36994
36985
  }
36995
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
36996
- }
36997
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36998
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
36999
- const gridPoints = [...allWaypoints, ...toVisitPoints];
37000
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
36986
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
36987
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
37001
36988
  let finalWaypoints = [startPoint];
37002
36989
  if (stemWaypoints.length > 0) {
37003
36990
  finalWaypoints.push(stemWaypoints[0]);
@@ -37008,7 +36995,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
37008
36995
  }
37009
36996
  finalWaypoints.push(endPoint);
37010
36997
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
37011
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
36998
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
37012
36999
  return {
37013
37000
  lines: getLines(pathPoints),
37014
37001
  newStart: startPoint,
package/dist/cjs/index.js CHANGED
@@ -36731,50 +36731,45 @@ function createGrid(start, end, toVisitPoints = []) {
36731
36731
  const startDir = getPointerDirection(start);
36732
36732
  const endDir = getPointerDirection(end);
36733
36733
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
36734
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
36734
36735
  const offsetMap = {
36735
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
36736
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
36737
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
36738
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
36736
+ top: { x: 0, y: -offset },
36737
+ bottom: { x: 0, y: offset },
36738
+ right: { x: offset, y: 0 },
36739
+ left: { x: -offset, y: 0 }
36739
36740
  };
36740
36741
  const horizontalLines = [];
36741
36742
  const verticalLines = [];
36742
- let newStart;
36743
- let newEnd;
36744
36743
  const processPoint = (point5, dir2) => {
36744
+ if (point5.pointType === "Board")
36745
+ return;
36745
36746
  const itemMbr = point5.item.getMbr();
36746
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
36747
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
36748
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
36749
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
36750
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
36751
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
36752
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
36753
- return newPoint;
36747
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
36748
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
36749
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
36750
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
36754
36751
  };
36755
36752
  if (start.pointType !== "Board" && startDir) {
36756
- newStart = processPoint(start, startDir);
36753
+ processPoint(start, startDir);
36757
36754
  }
36758
36755
  if (end.pointType !== "Board" && endDir) {
36759
- newEnd = processPoint(end, endDir);
36760
- }
36761
- const finalStart = newStart || start;
36762
- const finalEnd = newEnd || end;
36763
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
36764
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
36765
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
36766
- toVisitPoints.forEach((p3) => {
36756
+ processPoint(end, endDir);
36757
+ }
36758
+ const allPoints = [start, end, ...toVisitPoints];
36759
+ allPoints.forEach((p3) => {
36767
36760
  horizontalLines.push(p3.y);
36768
36761
  verticalLines.push(p3.x);
36769
36762
  });
36763
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
36764
+ horizontalLines.push(middle.y);
36765
+ verticalLines.push(middle.x);
36770
36766
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
36771
36767
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
36772
36768
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
36773
36769
  return {
36774
36770
  grid,
36775
- newStart,
36776
- newEnd,
36777
- middlePoint: middle
36771
+ newStart: start,
36772
+ newEnd: end
36778
36773
  };
36779
36774
  }
36780
36775
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -36934,18 +36929,15 @@ function reconstructPath(node2) {
36934
36929
  }
36935
36930
  return path2.reverse();
36936
36931
  }
36937
- function preCalculatePathPoints(start, end) {
36932
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36938
36933
  const startDir = getPointerDirection(start);
36939
36934
  const endDir = getPointerDirection(end);
36940
36935
  const offset = conf.CONNECTOR_ITEM_OFFSET;
36941
36936
  let startPoint = start;
36942
36937
  let endPoint = end;
36943
- const stemWaypoints = [];
36944
- const allWaypoints = [];
36945
36938
  const processPoint = (point5, dir2) => {
36946
- if (point5.pointType === "Board") {
36939
+ if (point5.pointType === "Board")
36947
36940
  return point5;
36948
- }
36949
36941
  const offsetMap = {
36950
36942
  top: { x: 0, y: -offset },
36951
36943
  bottom: { x: 0, y: offset },
@@ -36966,6 +36958,7 @@ function preCalculatePathPoints(start, end) {
36966
36958
  if (end.pointType !== "Board" && endDir) {
36967
36959
  endPoint = processPoint(end, endDir);
36968
36960
  }
36961
+ const stemWaypoints = [];
36969
36962
  if (startDir) {
36970
36963
  let stem;
36971
36964
  if (startDir === "right")
@@ -36977,7 +36970,6 @@ function preCalculatePathPoints(start, end) {
36977
36970
  else
36978
36971
  stem = new Point(startPoint.x, startPoint.y - offset);
36979
36972
  stemWaypoints.push(stem);
36980
- allWaypoints.push(stem);
36981
36973
  }
36982
36974
  if (endDir) {
36983
36975
  let stem;
@@ -36990,14 +36982,9 @@ function preCalculatePathPoints(start, end) {
36990
36982
  else
36991
36983
  stem = new Point(endPoint.x, endPoint.y - offset);
36992
36984
  stemWaypoints.push(stem);
36993
- allWaypoints.push(stem);
36994
36985
  }
36995
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
36996
- }
36997
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36998
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
36999
- const gridPoints = [...allWaypoints, ...toVisitPoints];
37000
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
36986
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
36987
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
37001
36988
  let finalWaypoints = [startPoint];
37002
36989
  if (stemWaypoints.length > 0) {
37003
36990
  finalWaypoints.push(stemWaypoints[0]);
@@ -37008,7 +36995,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
37008
36995
  }
37009
36996
  finalWaypoints.push(endPoint);
37010
36997
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
37011
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
36998
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
37012
36999
  return {
37013
37000
  lines: getLines(pathPoints),
37014
37001
  newStart: startPoint,
package/dist/cjs/node.js CHANGED
@@ -39204,50 +39204,45 @@ function createGrid(start, end, toVisitPoints = []) {
39204
39204
  const startDir = getPointerDirection(start);
39205
39205
  const endDir = getPointerDirection(end);
39206
39206
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
39207
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
39207
39208
  const offsetMap = {
39208
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
39209
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
39210
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
39211
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
39209
+ top: { x: 0, y: -offset },
39210
+ bottom: { x: 0, y: offset },
39211
+ right: { x: offset, y: 0 },
39212
+ left: { x: -offset, y: 0 }
39212
39213
  };
39213
39214
  const horizontalLines = [];
39214
39215
  const verticalLines = [];
39215
- let newStart;
39216
- let newEnd;
39217
39216
  const processPoint = (point5, dir2) => {
39217
+ if (point5.pointType === "Board")
39218
+ return;
39218
39219
  const itemMbr = point5.item.getMbr();
39219
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
39220
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
39221
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
39222
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
39223
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
39224
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
39225
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
39226
- return newPoint;
39220
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
39221
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
39222
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
39223
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
39227
39224
  };
39228
39225
  if (start.pointType !== "Board" && startDir) {
39229
- newStart = processPoint(start, startDir);
39226
+ processPoint(start, startDir);
39230
39227
  }
39231
39228
  if (end.pointType !== "Board" && endDir) {
39232
- newEnd = processPoint(end, endDir);
39233
- }
39234
- const finalStart = newStart || start;
39235
- const finalEnd = newEnd || end;
39236
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
39237
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
39238
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
39239
- toVisitPoints.forEach((p3) => {
39229
+ processPoint(end, endDir);
39230
+ }
39231
+ const allPoints = [start, end, ...toVisitPoints];
39232
+ allPoints.forEach((p3) => {
39240
39233
  horizontalLines.push(p3.y);
39241
39234
  verticalLines.push(p3.x);
39242
39235
  });
39236
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
39237
+ horizontalLines.push(middle.y);
39238
+ verticalLines.push(middle.x);
39243
39239
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
39244
39240
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
39245
39241
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
39246
39242
  return {
39247
39243
  grid,
39248
- newStart,
39249
- newEnd,
39250
- middlePoint: middle
39244
+ newStart: start,
39245
+ newEnd: end
39251
39246
  };
39252
39247
  }
39253
39248
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -39407,18 +39402,15 @@ function reconstructPath(node2) {
39407
39402
  }
39408
39403
  return path2.reverse();
39409
39404
  }
39410
- function preCalculatePathPoints(start, end) {
39405
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39411
39406
  const startDir = getPointerDirection(start);
39412
39407
  const endDir = getPointerDirection(end);
39413
39408
  const offset = conf.CONNECTOR_ITEM_OFFSET;
39414
39409
  let startPoint = start;
39415
39410
  let endPoint = end;
39416
- const stemWaypoints = [];
39417
- const allWaypoints = [];
39418
39411
  const processPoint = (point5, dir2) => {
39419
- if (point5.pointType === "Board") {
39412
+ if (point5.pointType === "Board")
39420
39413
  return point5;
39421
- }
39422
39414
  const offsetMap = {
39423
39415
  top: { x: 0, y: -offset },
39424
39416
  bottom: { x: 0, y: offset },
@@ -39439,6 +39431,7 @@ function preCalculatePathPoints(start, end) {
39439
39431
  if (end.pointType !== "Board" && endDir) {
39440
39432
  endPoint = processPoint(end, endDir);
39441
39433
  }
39434
+ const stemWaypoints = [];
39442
39435
  if (startDir) {
39443
39436
  let stem;
39444
39437
  if (startDir === "right")
@@ -39450,7 +39443,6 @@ function preCalculatePathPoints(start, end) {
39450
39443
  else
39451
39444
  stem = new Point(startPoint.x, startPoint.y - offset);
39452
39445
  stemWaypoints.push(stem);
39453
- allWaypoints.push(stem);
39454
39446
  }
39455
39447
  if (endDir) {
39456
39448
  let stem;
@@ -39463,14 +39455,9 @@ function preCalculatePathPoints(start, end) {
39463
39455
  else
39464
39456
  stem = new Point(endPoint.x, endPoint.y - offset);
39465
39457
  stemWaypoints.push(stem);
39466
- allWaypoints.push(stem);
39467
39458
  }
39468
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
39469
- }
39470
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39471
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
39472
- const gridPoints = [...allWaypoints, ...toVisitPoints];
39473
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
39459
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
39460
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
39474
39461
  let finalWaypoints = [startPoint];
39475
39462
  if (stemWaypoints.length > 0) {
39476
39463
  finalWaypoints.push(stemWaypoints[0]);
@@ -39481,7 +39468,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39481
39468
  }
39482
39469
  finalWaypoints.push(endPoint);
39483
39470
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
39484
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
39471
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
39485
39472
  return {
39486
39473
  lines: getLines(pathPoints),
39487
39474
  newStart: startPoint,
@@ -36576,50 +36576,45 @@ function createGrid(start, end, toVisitPoints = []) {
36576
36576
  const startDir = getPointerDirection(start);
36577
36577
  const endDir = getPointerDirection(end);
36578
36578
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
36579
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
36579
36580
  const offsetMap = {
36580
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
36581
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
36582
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
36583
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
36581
+ top: { x: 0, y: -offset },
36582
+ bottom: { x: 0, y: offset },
36583
+ right: { x: offset, y: 0 },
36584
+ left: { x: -offset, y: 0 }
36584
36585
  };
36585
36586
  const horizontalLines = [];
36586
36587
  const verticalLines = [];
36587
- let newStart;
36588
- let newEnd;
36589
36588
  const processPoint = (point5, dir2) => {
36589
+ if (point5.pointType === "Board")
36590
+ return;
36590
36591
  const itemMbr = point5.item.getMbr();
36591
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
36592
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
36593
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
36594
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
36595
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
36596
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
36597
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
36598
- return newPoint;
36592
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
36593
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
36594
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
36595
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
36599
36596
  };
36600
36597
  if (start.pointType !== "Board" && startDir) {
36601
- newStart = processPoint(start, startDir);
36598
+ processPoint(start, startDir);
36602
36599
  }
36603
36600
  if (end.pointType !== "Board" && endDir) {
36604
- newEnd = processPoint(end, endDir);
36605
- }
36606
- const finalStart = newStart || start;
36607
- const finalEnd = newEnd || end;
36608
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
36609
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
36610
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
36611
- toVisitPoints.forEach((p3) => {
36601
+ processPoint(end, endDir);
36602
+ }
36603
+ const allPoints = [start, end, ...toVisitPoints];
36604
+ allPoints.forEach((p3) => {
36612
36605
  horizontalLines.push(p3.y);
36613
36606
  verticalLines.push(p3.x);
36614
36607
  });
36608
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
36609
+ horizontalLines.push(middle.y);
36610
+ verticalLines.push(middle.x);
36615
36611
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
36616
36612
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
36617
36613
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
36618
36614
  return {
36619
36615
  grid,
36620
- newStart,
36621
- newEnd,
36622
- middlePoint: middle
36616
+ newStart: start,
36617
+ newEnd: end
36623
36618
  };
36624
36619
  }
36625
36620
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -36779,18 +36774,15 @@ function reconstructPath(node2) {
36779
36774
  }
36780
36775
  return path2.reverse();
36781
36776
  }
36782
- function preCalculatePathPoints(start, end) {
36777
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36783
36778
  const startDir = getPointerDirection(start);
36784
36779
  const endDir = getPointerDirection(end);
36785
36780
  const offset = conf.CONNECTOR_ITEM_OFFSET;
36786
36781
  let startPoint = start;
36787
36782
  let endPoint = end;
36788
- const stemWaypoints = [];
36789
- const allWaypoints = [];
36790
36783
  const processPoint = (point5, dir2) => {
36791
- if (point5.pointType === "Board") {
36784
+ if (point5.pointType === "Board")
36792
36785
  return point5;
36793
- }
36794
36786
  const offsetMap = {
36795
36787
  top: { x: 0, y: -offset },
36796
36788
  bottom: { x: 0, y: offset },
@@ -36811,6 +36803,7 @@ function preCalculatePathPoints(start, end) {
36811
36803
  if (end.pointType !== "Board" && endDir) {
36812
36804
  endPoint = processPoint(end, endDir);
36813
36805
  }
36806
+ const stemWaypoints = [];
36814
36807
  if (startDir) {
36815
36808
  let stem;
36816
36809
  if (startDir === "right")
@@ -36822,7 +36815,6 @@ function preCalculatePathPoints(start, end) {
36822
36815
  else
36823
36816
  stem = new Point(startPoint.x, startPoint.y - offset);
36824
36817
  stemWaypoints.push(stem);
36825
- allWaypoints.push(stem);
36826
36818
  }
36827
36819
  if (endDir) {
36828
36820
  let stem;
@@ -36835,14 +36827,9 @@ function preCalculatePathPoints(start, end) {
36835
36827
  else
36836
36828
  stem = new Point(endPoint.x, endPoint.y - offset);
36837
36829
  stemWaypoints.push(stem);
36838
- allWaypoints.push(stem);
36839
36830
  }
36840
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
36841
- }
36842
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36843
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
36844
- const gridPoints = [...allWaypoints, ...toVisitPoints];
36845
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
36831
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
36832
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
36846
36833
  let finalWaypoints = [startPoint];
36847
36834
  if (stemWaypoints.length > 0) {
36848
36835
  finalWaypoints.push(stemWaypoints[0]);
@@ -36853,7 +36840,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36853
36840
  }
36854
36841
  finalWaypoints.push(endPoint);
36855
36842
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
36856
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
36843
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
36857
36844
  return {
36858
36845
  lines: getLines(pathPoints),
36859
36846
  newStart: startPoint,
package/dist/esm/index.js CHANGED
@@ -36569,50 +36569,45 @@ function createGrid(start, end, toVisitPoints = []) {
36569
36569
  const startDir = getPointerDirection(start);
36570
36570
  const endDir = getPointerDirection(end);
36571
36571
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
36572
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
36572
36573
  const offsetMap = {
36573
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
36574
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
36575
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
36576
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
36574
+ top: { x: 0, y: -offset },
36575
+ bottom: { x: 0, y: offset },
36576
+ right: { x: offset, y: 0 },
36577
+ left: { x: -offset, y: 0 }
36577
36578
  };
36578
36579
  const horizontalLines = [];
36579
36580
  const verticalLines = [];
36580
- let newStart;
36581
- let newEnd;
36582
36581
  const processPoint = (point5, dir2) => {
36582
+ if (point5.pointType === "Board")
36583
+ return;
36583
36584
  const itemMbr = point5.item.getMbr();
36584
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
36585
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
36586
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
36587
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
36588
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
36589
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
36590
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
36591
- return newPoint;
36585
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
36586
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
36587
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
36588
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
36592
36589
  };
36593
36590
  if (start.pointType !== "Board" && startDir) {
36594
- newStart = processPoint(start, startDir);
36591
+ processPoint(start, startDir);
36595
36592
  }
36596
36593
  if (end.pointType !== "Board" && endDir) {
36597
- newEnd = processPoint(end, endDir);
36598
- }
36599
- const finalStart = newStart || start;
36600
- const finalEnd = newEnd || end;
36601
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
36602
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
36603
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
36604
- toVisitPoints.forEach((p3) => {
36594
+ processPoint(end, endDir);
36595
+ }
36596
+ const allPoints = [start, end, ...toVisitPoints];
36597
+ allPoints.forEach((p3) => {
36605
36598
  horizontalLines.push(p3.y);
36606
36599
  verticalLines.push(p3.x);
36607
36600
  });
36601
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
36602
+ horizontalLines.push(middle.y);
36603
+ verticalLines.push(middle.x);
36608
36604
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
36609
36605
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
36610
36606
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
36611
36607
  return {
36612
36608
  grid,
36613
- newStart,
36614
- newEnd,
36615
- middlePoint: middle
36609
+ newStart: start,
36610
+ newEnd: end
36616
36611
  };
36617
36612
  }
36618
36613
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -36772,18 +36767,15 @@ function reconstructPath(node2) {
36772
36767
  }
36773
36768
  return path2.reverse();
36774
36769
  }
36775
- function preCalculatePathPoints(start, end) {
36770
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36776
36771
  const startDir = getPointerDirection(start);
36777
36772
  const endDir = getPointerDirection(end);
36778
36773
  const offset = conf.CONNECTOR_ITEM_OFFSET;
36779
36774
  let startPoint = start;
36780
36775
  let endPoint = end;
36781
- const stemWaypoints = [];
36782
- const allWaypoints = [];
36783
36776
  const processPoint = (point5, dir2) => {
36784
- if (point5.pointType === "Board") {
36777
+ if (point5.pointType === "Board")
36785
36778
  return point5;
36786
- }
36787
36779
  const offsetMap = {
36788
36780
  top: { x: 0, y: -offset },
36789
36781
  bottom: { x: 0, y: offset },
@@ -36804,6 +36796,7 @@ function preCalculatePathPoints(start, end) {
36804
36796
  if (end.pointType !== "Board" && endDir) {
36805
36797
  endPoint = processPoint(end, endDir);
36806
36798
  }
36799
+ const stemWaypoints = [];
36807
36800
  if (startDir) {
36808
36801
  let stem;
36809
36802
  if (startDir === "right")
@@ -36815,7 +36808,6 @@ function preCalculatePathPoints(start, end) {
36815
36808
  else
36816
36809
  stem = new Point(startPoint.x, startPoint.y - offset);
36817
36810
  stemWaypoints.push(stem);
36818
- allWaypoints.push(stem);
36819
36811
  }
36820
36812
  if (endDir) {
36821
36813
  let stem;
@@ -36828,14 +36820,9 @@ function preCalculatePathPoints(start, end) {
36828
36820
  else
36829
36821
  stem = new Point(endPoint.x, endPoint.y - offset);
36830
36822
  stemWaypoints.push(stem);
36831
- allWaypoints.push(stem);
36832
36823
  }
36833
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
36834
- }
36835
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36836
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
36837
- const gridPoints = [...allWaypoints, ...toVisitPoints];
36838
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
36824
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
36825
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
36839
36826
  let finalWaypoints = [startPoint];
36840
36827
  if (stemWaypoints.length > 0) {
36841
36828
  finalWaypoints.push(stemWaypoints[0]);
@@ -36846,7 +36833,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
36846
36833
  }
36847
36834
  finalWaypoints.push(endPoint);
36848
36835
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
36849
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
36836
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
36850
36837
  return {
36851
36838
  lines: getLines(pathPoints),
36852
36839
  newStart: startPoint,
package/dist/esm/node.js CHANGED
@@ -39037,50 +39037,45 @@ function createGrid(start, end, toVisitPoints = []) {
39037
39037
  const startDir = getPointerDirection(start);
39038
39038
  const endDir = getPointerDirection(end);
39039
39039
  const revertMapDir = { top: 0, bottom: 1, right: 2, left: 3 };
39040
+ const offset = conf.CONNECTOR_ITEM_OFFSET;
39040
39041
  const offsetMap = {
39041
- top: { x: 0, y: -conf.CONNECTOR_ITEM_OFFSET },
39042
- bottom: { x: 0, y: conf.CONNECTOR_ITEM_OFFSET },
39043
- right: { x: conf.CONNECTOR_ITEM_OFFSET, y: 0 },
39044
- left: { x: -conf.CONNECTOR_ITEM_OFFSET, y: 0 }
39042
+ top: { x: 0, y: -offset },
39043
+ bottom: { x: 0, y: offset },
39044
+ right: { x: offset, y: 0 },
39045
+ left: { x: -offset, y: 0 }
39045
39046
  };
39046
39047
  const horizontalLines = [];
39047
39048
  const verticalLines = [];
39048
- let newStart;
39049
- let newEnd;
39050
39049
  const processPoint = (point5, dir2) => {
39050
+ if (point5.pointType === "Board")
39051
+ return;
39051
39052
  const itemMbr = point5.item.getMbr();
39052
- const mbrFloored = new Mbr(Math.floor(itemMbr.left), Math.floor(itemMbr.top), Math.floor(itemMbr.right), Math.floor(itemMbr.bottom));
39053
- const pointOnMbr = mbrFloored.getLines()[revertMapDir[dir2]].getNearestPointOnLineSegment(point5);
39054
- const newPoint = Object.create(Object.getPrototypeOf(point5), Object.getOwnPropertyDescriptors(point5));
39055
- newPoint.x = pointOnMbr.x + offsetMap[dir2].x;
39056
- newPoint.y = pointOnMbr.y + offsetMap[dir2].y;
39057
- verticalLines.push(mbrFloored.left - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.left, pointOnMbr.x, mbrFloored.right, mbrFloored.right + conf.CONNECTOR_ITEM_OFFSET);
39058
- horizontalLines.push(mbrFloored.top - conf.CONNECTOR_ITEM_OFFSET, mbrFloored.top, pointOnMbr.y, mbrFloored.bottom, mbrFloored.bottom + conf.CONNECTOR_ITEM_OFFSET);
39059
- return newPoint;
39053
+ const pointOnMbrX = point5.x - offsetMap[dir2].x;
39054
+ const pointOnMbrY = point5.y - offsetMap[dir2].y;
39055
+ verticalLines.push(itemMbr.left - offset, itemMbr.left, pointOnMbrX, itemMbr.right, itemMbr.right + offset);
39056
+ horizontalLines.push(itemMbr.top - offset, itemMbr.top, pointOnMbrY, itemMbr.bottom, itemMbr.bottom + offset);
39060
39057
  };
39061
39058
  if (start.pointType !== "Board" && startDir) {
39062
- newStart = processPoint(start, startDir);
39059
+ processPoint(start, startDir);
39063
39060
  }
39064
39061
  if (end.pointType !== "Board" && endDir) {
39065
- newEnd = processPoint(end, endDir);
39066
- }
39067
- const finalStart = newStart || start;
39068
- const finalEnd = newEnd || end;
39069
- const middle = new Point((finalStart.x + finalEnd.x) / 2, (finalStart.y + finalEnd.y) / 2);
39070
- horizontalLines.push(middle.y, finalStart.y, finalEnd.y);
39071
- verticalLines.push(middle.x, finalStart.x, finalEnd.x);
39072
- toVisitPoints.forEach((p3) => {
39062
+ processPoint(end, endDir);
39063
+ }
39064
+ const allPoints = [start, end, ...toVisitPoints];
39065
+ allPoints.forEach((p3) => {
39073
39066
  horizontalLines.push(p3.y);
39074
39067
  verticalLines.push(p3.x);
39075
39068
  });
39069
+ const middle = new Point((start.x + end.x) / 2, (start.y + end.y) / 2);
39070
+ horizontalLines.push(middle.y);
39071
+ verticalLines.push(middle.x);
39076
39072
  const uniqueHorizontalLines = Array.from(new Set(horizontalLines)).sort((a2, b) => a2 - b);
39077
39073
  const uniqueVerticalLines = Array.from(new Set(verticalLines)).sort((a2, b) => a2 - b);
39078
39074
  const grid = uniqueVerticalLines.map((x) => uniqueHorizontalLines.map((y) => new Point(x, y)));
39079
39075
  return {
39080
39076
  grid,
39081
- newStart,
39082
- newEnd,
39083
- middlePoint: middle
39077
+ newStart: start,
39078
+ newEnd: end
39084
39079
  };
39085
39080
  }
39086
39081
  function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
@@ -39240,18 +39235,15 @@ function reconstructPath(node2) {
39240
39235
  }
39241
39236
  return path2.reverse();
39242
39237
  }
39243
- function preCalculatePathPoints(start, end) {
39238
+ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39244
39239
  const startDir = getPointerDirection(start);
39245
39240
  const endDir = getPointerDirection(end);
39246
39241
  const offset = conf.CONNECTOR_ITEM_OFFSET;
39247
39242
  let startPoint = start;
39248
39243
  let endPoint = end;
39249
- const stemWaypoints = [];
39250
- const allWaypoints = [];
39251
39244
  const processPoint = (point5, dir2) => {
39252
- if (point5.pointType === "Board") {
39245
+ if (point5.pointType === "Board")
39253
39246
  return point5;
39254
- }
39255
39247
  const offsetMap = {
39256
39248
  top: { x: 0, y: -offset },
39257
39249
  bottom: { x: 0, y: offset },
@@ -39272,6 +39264,7 @@ function preCalculatePathPoints(start, end) {
39272
39264
  if (end.pointType !== "Board" && endDir) {
39273
39265
  endPoint = processPoint(end, endDir);
39274
39266
  }
39267
+ const stemWaypoints = [];
39275
39268
  if (startDir) {
39276
39269
  let stem;
39277
39270
  if (startDir === "right")
@@ -39283,7 +39276,6 @@ function preCalculatePathPoints(start, end) {
39283
39276
  else
39284
39277
  stem = new Point(startPoint.x, startPoint.y - offset);
39285
39278
  stemWaypoints.push(stem);
39286
- allWaypoints.push(stem);
39287
39279
  }
39288
39280
  if (endDir) {
39289
39281
  let stem;
@@ -39296,14 +39288,9 @@ function preCalculatePathPoints(start, end) {
39296
39288
  else
39297
39289
  stem = new Point(endPoint.x, endPoint.y - offset);
39298
39290
  stemWaypoints.push(stem);
39299
- allWaypoints.push(stem);
39300
39291
  }
39301
- return { startPoint, endPoint, stemWaypoints, allWaypoints };
39302
- }
39303
- function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39304
- const { startPoint, endPoint, stemWaypoints, allWaypoints } = preCalculatePathPoints(start, end);
39305
- const gridPoints = [...allWaypoints, ...toVisitPoints];
39306
- const { grid, newStart, newEnd } = createGrid(start, end, gridPoints);
39292
+ const allGridPoints = [startPoint, endPoint, ...stemWaypoints, ...toVisitPoints];
39293
+ const { grid } = createGrid(startPoint, endPoint, allGridPoints);
39307
39294
  let finalWaypoints = [startPoint];
39308
39295
  if (stemWaypoints.length > 0) {
39309
39296
  finalWaypoints.push(stemWaypoints[0]);
@@ -39314,7 +39301,7 @@ function findOrthogonalPath(start, end, obstacles, toVisitPoints = []) {
39314
39301
  }
39315
39302
  finalWaypoints.push(endPoint);
39316
39303
  const uniqueWaypoints = finalWaypoints.filter((point5, index2, self2) => index2 === 0 || !point5.barelyEqual(self2[index2 - 1]));
39317
- const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, newStart, newEnd);
39304
+ const pathPoints = findPathPoints(uniqueWaypoints, grid, obstacles, startPoint, endPoint);
39318
39305
  return {
39319
39306
  lines: getLines(pathPoints),
39320
39307
  newStart: startPoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.82",
3
+ "version": "0.5.83",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",