microboard-temp 0.13.53 → 0.13.54

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.
@@ -60927,8 +60927,12 @@ class ForceGraphEngine {
60927
60927
  continue;
60928
60928
  const dx = s2.cx - s1.cx;
60929
60929
  const dy = s2.cy - s1.cy;
60930
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
60931
- const force = conf.FG_REPULSION / distSq;
60930
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
60931
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
60932
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
60933
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
60934
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
60935
+ const force = conf.FG_REPULSION / edgeDistSq;
60932
60936
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
60933
60937
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
60934
60938
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
package/dist/cjs/index.js CHANGED
@@ -60927,8 +60927,12 @@ class ForceGraphEngine {
60927
60927
  continue;
60928
60928
  const dx = s2.cx - s1.cx;
60929
60929
  const dy = s2.cy - s1.cy;
60930
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
60931
- const force = conf.FG_REPULSION / distSq;
60930
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
60931
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
60932
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
60933
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
60934
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
60935
+ const force = conf.FG_REPULSION / edgeDistSq;
60932
60936
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
60933
60937
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
60934
60938
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
package/dist/cjs/node.js CHANGED
@@ -63402,8 +63402,12 @@ class ForceGraphEngine {
63402
63402
  continue;
63403
63403
  const dx = s2.cx - s1.cx;
63404
63404
  const dy = s2.cy - s1.cy;
63405
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
63406
- const force = conf.FG_REPULSION / distSq;
63405
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
63406
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
63407
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
63408
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
63409
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
63410
+ const force = conf.FG_REPULSION / edgeDistSq;
63407
63411
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
63408
63412
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
63409
63413
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
@@ -60670,8 +60670,12 @@ class ForceGraphEngine {
60670
60670
  continue;
60671
60671
  const dx = s2.cx - s1.cx;
60672
60672
  const dy = s2.cy - s1.cy;
60673
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
60674
- const force = conf.FG_REPULSION / distSq;
60673
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
60674
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
60675
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
60676
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
60677
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
60678
+ const force = conf.FG_REPULSION / edgeDistSq;
60675
60679
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
60676
60680
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
60677
60681
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
package/dist/esm/index.js CHANGED
@@ -60663,8 +60663,12 @@ class ForceGraphEngine {
60663
60663
  continue;
60664
60664
  const dx = s2.cx - s1.cx;
60665
60665
  const dy = s2.cy - s1.cy;
60666
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
60667
- const force = conf.FG_REPULSION / distSq;
60666
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
60667
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
60668
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
60669
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
60670
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
60671
+ const force = conf.FG_REPULSION / edgeDistSq;
60668
60672
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
60669
60673
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
60670
60674
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
package/dist/esm/node.js CHANGED
@@ -63127,8 +63127,12 @@ class ForceGraphEngine {
63127
63127
  continue;
63128
63128
  const dx = s2.cx - s1.cx;
63129
63129
  const dy = s2.cy - s1.cy;
63130
- const distSq = Math.max(dx * dx + dy * dy, conf.FG_MIN_DIST_SQ);
63131
- const force = conf.FG_REPULSION / distSq;
63130
+ const centerDist = Math.sqrt(dx * dx + dy * dy) || 1;
63131
+ const halfA = Math.max(s1.w, s1.h) * 0.5;
63132
+ const halfB = Math.max(s2.w, s2.h) * 0.5;
63133
+ const edgeDist = Math.max(centerDist - halfA - halfB, 0);
63134
+ const edgeDistSq = Math.max(edgeDist * edgeDist, conf.FG_MIN_DIST_SQ);
63135
+ const force = conf.FG_REPULSION / edgeDistSq;
63132
63136
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - dx * force);
63133
63137
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - dy * force);
63134
63138
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + dx * force);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.53",
3
+ "version": "0.13.54",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",