microboard-temp 0.5.98 → 0.5.99

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.
@@ -36703,7 +36703,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
36703
36703
  return 0;
36704
36704
  }
36705
36705
  function heuristic(start, end) {
36706
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
36706
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
36707
36707
  }
36708
36708
  function getNeighbors(node2, grid, obstacles) {
36709
36709
  const neighbors = [];
@@ -36831,9 +36831,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36831
36831
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36832
36832
  continue;
36833
36833
  }
36834
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36834
+ const TURN_PENALTY = 500;
36835
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36836
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36835
36837
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36836
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
36838
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36837
36839
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36838
36840
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36839
36841
  if (existingNodeInOpenSet) {
package/dist/cjs/index.js CHANGED
@@ -36703,7 +36703,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
36703
36703
  return 0;
36704
36704
  }
36705
36705
  function heuristic(start, end) {
36706
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
36706
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
36707
36707
  }
36708
36708
  function getNeighbors(node2, grid, obstacles) {
36709
36709
  const neighbors = [];
@@ -36831,9 +36831,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36831
36831
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36832
36832
  continue;
36833
36833
  }
36834
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36834
+ const TURN_PENALTY = 500;
36835
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36836
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36835
36837
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36836
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
36838
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36837
36839
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36838
36840
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36839
36841
  if (existingNodeInOpenSet) {
package/dist/cjs/node.js CHANGED
@@ -39176,7 +39176,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
39176
39176
  return 0;
39177
39177
  }
39178
39178
  function heuristic(start, end) {
39179
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
39179
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
39180
39180
  }
39181
39181
  function getNeighbors(node2, grid, obstacles) {
39182
39182
  const neighbors = [];
@@ -39304,9 +39304,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39304
39304
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
39305
39305
  continue;
39306
39306
  }
39307
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
39307
+ const TURN_PENALTY = 500;
39308
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
39309
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
39308
39310
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
39309
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
39311
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
39310
39312
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
39311
39313
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
39312
39314
  if (existingNodeInOpenSet) {
@@ -36548,7 +36548,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
36548
36548
  return 0;
36549
36549
  }
36550
36550
  function heuristic(start, end) {
36551
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
36551
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
36552
36552
  }
36553
36553
  function getNeighbors(node2, grid, obstacles) {
36554
36554
  const neighbors = [];
@@ -36676,9 +36676,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36676
36676
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36677
36677
  continue;
36678
36678
  }
36679
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36679
+ const TURN_PENALTY = 500;
36680
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36681
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36680
36682
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36681
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
36683
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36682
36684
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36683
36685
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36684
36686
  if (existingNodeInOpenSet) {
package/dist/esm/index.js CHANGED
@@ -36541,7 +36541,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
36541
36541
  return 0;
36542
36542
  }
36543
36543
  function heuristic(start, end) {
36544
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
36544
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
36545
36545
  }
36546
36546
  function getNeighbors(node2, grid, obstacles) {
36547
36547
  const neighbors = [];
@@ -36669,9 +36669,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
36669
36669
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
36670
36670
  continue;
36671
36671
  }
36672
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
36672
+ const TURN_PENALTY = 500;
36673
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
36674
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
36673
36675
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
36674
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
36676
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
36675
36677
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
36676
36678
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
36677
36679
  if (existingNodeInOpenSet) {
package/dist/esm/node.js CHANGED
@@ -39009,7 +39009,7 @@ function isChangingDirection(current, neighbor, newStart, newEnd) {
39009
39009
  return 0;
39010
39010
  }
39011
39011
  function heuristic(start, end) {
39012
- return Math.abs(start.xGrid - end.xGrid) + Math.abs(start.yGrid - end.yGrid);
39012
+ return Math.abs(start.point.x - end.point.x) + Math.abs(start.point.y - end.point.y);
39013
39013
  }
39014
39014
  function getNeighbors(node2, grid, obstacles) {
39015
39015
  const neighbors = [];
@@ -39137,9 +39137,11 @@ function findPath(start, end, grid, obstacles, existingPath, newStart, newEnd) {
39137
39137
  if (closedSet.has(neighborKey) || existingPath.has(neighborKey) && !neighbor.point.barelyEqual(end)) {
39138
39138
  continue;
39139
39139
  }
39140
- const extraCost = isChangingDirection(current, neighbor, newStart, newEnd);
39140
+ const TURN_PENALTY = 500;
39141
+ const extraCost = isChangingDirection(current, neighbor, newStart, newEnd) ? TURN_PENALTY : 0;
39142
+ const movementCost = Math.abs(current.point.x - neighbor.point.x) + Math.abs(current.point.y - neighbor.point.y);
39141
39143
  const pathOverlapCost = existingPath.has(neighborKey) ? 1000 : 0;
39142
- const tentativeCost = current.costSoFar + 1 + pathOverlapCost;
39144
+ const tentativeCost = current.costSoFar + movementCost + pathOverlapCost;
39143
39145
  let existingNodeInOpenSet = openSet.find((node2) => node2.point.barelyEqual(neighbor.point));
39144
39146
  if (!existingNodeInOpenSet || tentativeCost < existingNodeInOpenSet.costSoFar) {
39145
39147
  if (existingNodeInOpenSet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.5.98",
3
+ "version": "0.5.99",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",