microboard-temp 0.5.99 → 0.5.100

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.
@@ -36682,7 +36682,7 @@ function getDirection(from, to) {
36682
36682
  return null;
36683
36683
  }
36684
36684
  function isChangingDirection(current, neighbor, newStart, newEnd) {
36685
- const TURN_PENALTY = 50;
36685
+ const TURN_PENALTY = 5000;
36686
36686
  const dirMap = {
36687
36687
  top: "vertical",
36688
36688
  bottom: "vertical",
@@ -36809,8 +36809,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36809
36809
  const startNode = {
36810
36810
  point: start,
36811
36811
  costSoFar: 0,
36812
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36813
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36812
+ heuristic: heuristic({ point: start }, endNode),
36813
+ toFinish: heuristic({ point: start }, endNode),
36814
36814
  xGrid: startRowIndex,
36815
36815
  yGrid: startPointIndex
36816
36816
  };
@@ -36821,8 +36821,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36821
36821
  const current = openSet.shift();
36822
36822
  const currentKey = `${current.point.x},${current.point.y}`;
36823
36823
  if (current.point.barelyEqual(end)) {
36824
- const path2 = reconstructPath(current);
36825
- return path2;
36824
+ return reconstructPath(current);
36826
36825
  }
36827
36826
  closedSet.add(currentKey);
36828
36827
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -36831,20 +36830,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36831
36830
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36832
36831
  continue;
36833
36832
  }
36834
- const TURN_PENALTY = 500;
36835
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36833
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36836
36834
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36837
36835
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36838
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36836
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
36839
36837
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36840
36838
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36841
36839
  if (existingNodeInOpenSet) {
36842
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
36840
+ existingNodeInOpenSet.costSoFar = tentativeCost;
36843
36841
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
36844
36842
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
36845
36843
  existingNodeInOpenSet.parent = current;
36846
36844
  } else {
36847
- neighbor.costSoFar = tentativeCost + extraCost;
36845
+ neighbor.costSoFar = tentativeCost;
36848
36846
  neighbor.heuristic = heuristic(neighbor, endNode);
36849
36847
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
36850
36848
  openSet.push(neighbor);
package/dist/cjs/index.js CHANGED
@@ -36682,7 +36682,7 @@ function getDirection(from, to) {
36682
36682
  return null;
36683
36683
  }
36684
36684
  function isChangingDirection(current, neighbor, newStart, newEnd) {
36685
- const TURN_PENALTY = 50;
36685
+ const TURN_PENALTY = 5000;
36686
36686
  const dirMap = {
36687
36687
  top: "vertical",
36688
36688
  bottom: "vertical",
@@ -36809,8 +36809,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36809
36809
  const startNode = {
36810
36810
  point: start,
36811
36811
  costSoFar: 0,
36812
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36813
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36812
+ heuristic: heuristic({ point: start }, endNode),
36813
+ toFinish: heuristic({ point: start }, endNode),
36814
36814
  xGrid: startRowIndex,
36815
36815
  yGrid: startPointIndex
36816
36816
  };
@@ -36821,8 +36821,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36821
36821
  const current = openSet.shift();
36822
36822
  const currentKey = `${current.point.x},${current.point.y}`;
36823
36823
  if (current.point.barelyEqual(end)) {
36824
- const path2 = reconstructPath(current);
36825
- return path2;
36824
+ return reconstructPath(current);
36826
36825
  }
36827
36826
  closedSet.add(currentKey);
36828
36827
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -36831,20 +36830,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36831
36830
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36832
36831
  continue;
36833
36832
  }
36834
- const TURN_PENALTY = 500;
36835
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36833
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36836
36834
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36837
36835
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36838
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36836
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
36839
36837
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36840
36838
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36841
36839
  if (existingNodeInOpenSet) {
36842
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
36840
+ existingNodeInOpenSet.costSoFar = tentativeCost;
36843
36841
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
36844
36842
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
36845
36843
  existingNodeInOpenSet.parent = current;
36846
36844
  } else {
36847
- neighbor.costSoFar = tentativeCost + extraCost;
36845
+ neighbor.costSoFar = tentativeCost;
36848
36846
  neighbor.heuristic = heuristic(neighbor, endNode);
36849
36847
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
36850
36848
  openSet.push(neighbor);
package/dist/cjs/node.js CHANGED
@@ -39155,7 +39155,7 @@ function getDirection(from, to) {
39155
39155
  return null;
39156
39156
  }
39157
39157
  function isChangingDirection(current, neighbor, newStart, newEnd) {
39158
- const TURN_PENALTY = 50;
39158
+ const TURN_PENALTY = 5000;
39159
39159
  const dirMap = {
39160
39160
  top: "vertical",
39161
39161
  bottom: "vertical",
@@ -39282,8 +39282,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39282
39282
  const startNode = {
39283
39283
  point: start,
39284
39284
  costSoFar: 0,
39285
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
39286
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
39285
+ heuristic: heuristic({ point: start }, endNode),
39286
+ toFinish: heuristic({ point: start }, endNode),
39287
39287
  xGrid: startRowIndex,
39288
39288
  yGrid: startPointIndex
39289
39289
  };
@@ -39294,8 +39294,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39294
39294
  const current = openSet.shift();
39295
39295
  const currentKey = `${current.point.x},${current.point.y}`;
39296
39296
  if (current.point.barelyEqual(end)) {
39297
- const path2 = reconstructPath(current);
39298
- return path2;
39297
+ return reconstructPath(current);
39299
39298
  }
39300
39299
  closedSet.add(currentKey);
39301
39300
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -39304,20 +39303,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39304
39303
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
39305
39304
  continue;
39306
39305
  }
39307
- const TURN_PENALTY = 500;
39308
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
39306
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
39309
39307
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
39310
39308
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
39311
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
39309
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
39312
39310
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
39313
39311
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
39314
39312
  if (existingNodeInOpenSet) {
39315
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
39313
+ existingNodeInOpenSet.costSoFar = tentativeCost;
39316
39314
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
39317
39315
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
39318
39316
  existingNodeInOpenSet.parent = current;
39319
39317
  } else {
39320
- neighbor.costSoFar = tentativeCost + extraCost;
39318
+ neighbor.costSoFar = tentativeCost;
39321
39319
  neighbor.heuristic = heuristic(neighbor, endNode);
39322
39320
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
39323
39321
  openSet.push(neighbor);
@@ -36527,7 +36527,7 @@ function getDirection(from, to) {
36527
36527
  return null;
36528
36528
  }
36529
36529
  function isChangingDirection(current, neighbor, newStart, newEnd) {
36530
- const TURN_PENALTY = 50;
36530
+ const TURN_PENALTY = 5000;
36531
36531
  const dirMap = {
36532
36532
  top: "vertical",
36533
36533
  bottom: "vertical",
@@ -36654,8 +36654,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36654
36654
  const startNode = {
36655
36655
  point: start,
36656
36656
  costSoFar: 0,
36657
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36658
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36657
+ heuristic: heuristic({ point: start }, endNode),
36658
+ toFinish: heuristic({ point: start }, endNode),
36659
36659
  xGrid: startRowIndex,
36660
36660
  yGrid: startPointIndex
36661
36661
  };
@@ -36666,8 +36666,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36666
36666
  const current = openSet.shift();
36667
36667
  const currentKey = `${current.point.x},${current.point.y}`;
36668
36668
  if (current.point.barelyEqual(end)) {
36669
- const path2 = reconstructPath(current);
36670
- return path2;
36669
+ return reconstructPath(current);
36671
36670
  }
36672
36671
  closedSet.add(currentKey);
36673
36672
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -36676,20 +36675,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36676
36675
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36677
36676
  continue;
36678
36677
  }
36679
- const TURN_PENALTY = 500;
36680
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36678
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36681
36679
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36682
36680
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36683
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36681
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
36684
36682
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36685
36683
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36686
36684
  if (existingNodeInOpenSet) {
36687
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
36685
+ existingNodeInOpenSet.costSoFar = tentativeCost;
36688
36686
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
36689
36687
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
36690
36688
  existingNodeInOpenSet.parent = current;
36691
36689
  } else {
36692
- neighbor.costSoFar = tentativeCost + extraCost;
36690
+ neighbor.costSoFar = tentativeCost;
36693
36691
  neighbor.heuristic = heuristic(neighbor, endNode);
36694
36692
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
36695
36693
  openSet.push(neighbor);
package/dist/esm/index.js CHANGED
@@ -36520,7 +36520,7 @@ function getDirection(from, to) {
36520
36520
  return null;
36521
36521
  }
36522
36522
  function isChangingDirection(current, neighbor, newStart, newEnd) {
36523
- const TURN_PENALTY = 50;
36523
+ const TURN_PENALTY = 5000;
36524
36524
  const dirMap = {
36525
36525
  top: "vertical",
36526
36526
  bottom: "vertical",
@@ -36647,8 +36647,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36647
36647
  const startNode = {
36648
36648
  point: start,
36649
36649
  costSoFar: 0,
36650
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36651
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
36650
+ heuristic: heuristic({ point: start }, endNode),
36651
+ toFinish: heuristic({ point: start }, endNode),
36652
36652
  xGrid: startRowIndex,
36653
36653
  yGrid: startPointIndex
36654
36654
  };
@@ -36659,8 +36659,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36659
36659
  const current = openSet.shift();
36660
36660
  const currentKey = `${current.point.x},${current.point.y}`;
36661
36661
  if (current.point.barelyEqual(end)) {
36662
- const path2 = reconstructPath(current);
36663
- return path2;
36662
+ return reconstructPath(current);
36664
36663
  }
36665
36664
  closedSet.add(currentKey);
36666
36665
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -36669,20 +36668,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36669
36668
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36670
36669
  continue;
36671
36670
  }
36672
- const TURN_PENALTY = 500;
36673
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36671
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36674
36672
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36675
36673
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36676
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36674
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
36677
36675
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36678
36676
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36679
36677
  if (existingNodeInOpenSet) {
36680
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
36678
+ existingNodeInOpenSet.costSoFar = tentativeCost;
36681
36679
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
36682
36680
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
36683
36681
  existingNodeInOpenSet.parent = current;
36684
36682
  } else {
36685
- neighbor.costSoFar = tentativeCost + extraCost;
36683
+ neighbor.costSoFar = tentativeCost;
36686
36684
  neighbor.heuristic = heuristic(neighbor, endNode);
36687
36685
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
36688
36686
  openSet.push(neighbor);
package/dist/esm/node.js CHANGED
@@ -38988,7 +38988,7 @@ function getDirection(from, to) {
38988
38988
  return null;
38989
38989
  }
38990
38990
  function isChangingDirection(current, neighbor, newStart, newEnd) {
38991
- const TURN_PENALTY = 50;
38991
+ const TURN_PENALTY = 5000;
38992
38992
  const dirMap = {
38993
38993
  top: "vertical",
38994
38994
  bottom: "vertical",
@@ -39115,8 +39115,8 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39115
39115
  const startNode = {
39116
39116
  point: start,
39117
39117
  costSoFar: 0,
39118
- heuristic: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
39119
- toFinish: heuristic({ point: start, xGrid: startRowIndex, yGrid: startPointIndex }, endNode),
39118
+ heuristic: heuristic({ point: start }, endNode),
39119
+ toFinish: heuristic({ point: start }, endNode),
39120
39120
  xGrid: startRowIndex,
39121
39121
  yGrid: startPointIndex
39122
39122
  };
@@ -39127,8 +39127,7 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39127
39127
  const current = openSet.shift();
39128
39128
  const currentKey = `${current.point.x},${current.point.y}`;
39129
39129
  if (current.point.barelyEqual(end)) {
39130
- const path2 = reconstructPath(current);
39131
- return path2;
39130
+ return reconstructPath(current);
39132
39131
  }
39133
39132
  closedSet.add(currentKey);
39134
39133
  const neighbors = getNeighbors(current, grid, obstacles);
@@ -39137,20 +39136,19 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39137
39136
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
39138
39137
  continue;
39139
39138
  }
39140
- const TURN_PENALTY = 500;
39141
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
39139
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
39142
39140
  const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
39143
39141
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
39144
- const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
39142
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost + extraCost;
39145
39143
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
39146
39144
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
39147
39145
  if (existingNodeInOpenSet) {
39148
- existingNodeInOpenSet.costSoFar = tentativeCost + extraCost;
39146
+ existingNodeInOpenSet.costSoFar = tentativeCost;
39149
39147
  existingNodeInOpenSet.heuristic = heuristic(neighbor, endNode);
39150
39148
  existingNodeInOpenSet.toFinish = existingNodeInOpenSet.costSoFar + existingNodeInOpenSet.heuristic;
39151
39149
  existingNodeInOpenSet.parent = current;
39152
39150
  } else {
39153
- neighbor.costSoFar = tentativeCost + extraCost;
39151
+ neighbor.costSoFar = tentativeCost;
39154
39152
  neighbor.heuristic = heuristic(neighbor, endNode);
39155
39153
  neighbor.toFinish = neighbor.costSoFar + neighbor.heuristic;
39156
39154
  openSet.push(neighbor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.99",
3
+ "version": "0.5.100",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",