microboard-temp 0.13.18 → 0.13.20

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.
@@ -4678,8 +4678,8 @@ var conf = {
4678
4678
  FG_SPRING_K: 3,
4679
4679
  FG_TARGET_GAP: 20,
4680
4680
  FG_REPULSION: 400000,
4681
- FG_DAMPING: 0.5,
4682
- FG_SLEEP_THRESHOLD: 2,
4681
+ FG_DAMPING: 0.9,
4682
+ FG_SLEEP_THRESHOLD: 10,
4683
4683
  GRAVITY_G: 80,
4684
4684
  GRAVITY_G_CENTER: 120,
4685
4685
  GRAVITY_DAMPING: 0.96,
@@ -54705,10 +54705,13 @@ class ForceGraphEngine {
54705
54705
  continue;
54706
54706
  const dx = s2.cx - s1.cx;
54707
54707
  const dy = s2.cy - s1.cy;
54708
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
54709
- const repMag = conf.FG_REPULSION / distSq;
54710
- const fx = dx * repMag;
54711
- const fy = dy * repMag;
54708
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54709
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
54710
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
54711
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
54712
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
54713
+ const fx = dx / centerDist * repMag;
54714
+ const fy = dy / centerDist * repMag;
54712
54715
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
54713
54716
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
54714
54717
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
package/dist/cjs/index.js CHANGED
@@ -4678,8 +4678,8 @@ var conf = {
4678
4678
  FG_SPRING_K: 3,
4679
4679
  FG_TARGET_GAP: 20,
4680
4680
  FG_REPULSION: 400000,
4681
- FG_DAMPING: 0.5,
4682
- FG_SLEEP_THRESHOLD: 2,
4681
+ FG_DAMPING: 0.9,
4682
+ FG_SLEEP_THRESHOLD: 10,
4683
4683
  GRAVITY_G: 80,
4684
4684
  GRAVITY_G_CENTER: 120,
4685
4685
  GRAVITY_DAMPING: 0.96,
@@ -54705,10 +54705,13 @@ class ForceGraphEngine {
54705
54705
  continue;
54706
54706
  const dx = s2.cx - s1.cx;
54707
54707
  const dy = s2.cy - s1.cy;
54708
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
54709
- const repMag = conf.FG_REPULSION / distSq;
54710
- const fx = dx * repMag;
54711
- const fy = dy * repMag;
54708
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54709
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
54710
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
54711
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
54712
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
54713
+ const fx = dx / centerDist * repMag;
54714
+ const fy = dy / centerDist * repMag;
54712
54715
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
54713
54716
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
54714
54717
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
package/dist/cjs/node.js CHANGED
@@ -5715,8 +5715,8 @@ var conf = {
5715
5715
  FG_SPRING_K: 3,
5716
5716
  FG_TARGET_GAP: 20,
5717
5717
  FG_REPULSION: 400000,
5718
- FG_DAMPING: 0.5,
5719
- FG_SLEEP_THRESHOLD: 2,
5718
+ FG_DAMPING: 0.9,
5719
+ FG_SLEEP_THRESHOLD: 10,
5720
5720
  GRAVITY_G: 80,
5721
5721
  GRAVITY_G_CENTER: 120,
5722
5722
  GRAVITY_DAMPING: 0.96,
@@ -57178,10 +57178,13 @@ class ForceGraphEngine {
57178
57178
  continue;
57179
57179
  const dx = s2.cx - s1.cx;
57180
57180
  const dy = s2.cy - s1.cy;
57181
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
57182
- const repMag = conf.FG_REPULSION / distSq;
57183
- const fx = dx * repMag;
57184
- const fy = dy * repMag;
57181
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
57182
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
57183
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
57184
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
57185
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
57186
+ const fx = dx / centerDist * repMag;
57187
+ const fy = dy / centerDist * repMag;
57185
57188
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
57186
57189
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
57187
57190
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
@@ -4498,8 +4498,8 @@ var conf = {
4498
4498
  FG_SPRING_K: 3,
4499
4499
  FG_TARGET_GAP: 20,
4500
4500
  FG_REPULSION: 400000,
4501
- FG_DAMPING: 0.5,
4502
- FG_SLEEP_THRESHOLD: 2,
4501
+ FG_DAMPING: 0.9,
4502
+ FG_SLEEP_THRESHOLD: 10,
4503
4503
  GRAVITY_G: 80,
4504
4504
  GRAVITY_G_CENTER: 120,
4505
4505
  GRAVITY_DAMPING: 0.96,
@@ -54534,10 +54534,13 @@ class ForceGraphEngine {
54534
54534
  continue;
54535
54535
  const dx = s2.cx - s1.cx;
54536
54536
  const dy = s2.cy - s1.cy;
54537
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
54538
- const repMag = conf.FG_REPULSION / distSq;
54539
- const fx = dx * repMag;
54540
- const fy = dy * repMag;
54537
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54538
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
54539
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
54540
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
54541
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
54542
+ const fx = dx / centerDist * repMag;
54543
+ const fy = dy / centerDist * repMag;
54541
54544
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
54542
54545
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
54543
54546
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
package/dist/esm/index.js CHANGED
@@ -4491,8 +4491,8 @@ var conf = {
4491
4491
  FG_SPRING_K: 3,
4492
4492
  FG_TARGET_GAP: 20,
4493
4493
  FG_REPULSION: 400000,
4494
- FG_DAMPING: 0.5,
4495
- FG_SLEEP_THRESHOLD: 2,
4494
+ FG_DAMPING: 0.9,
4495
+ FG_SLEEP_THRESHOLD: 10,
4496
4496
  GRAVITY_G: 80,
4497
4497
  GRAVITY_G_CENTER: 120,
4498
4498
  GRAVITY_DAMPING: 0.96,
@@ -54527,10 +54527,13 @@ class ForceGraphEngine {
54527
54527
  continue;
54528
54528
  const dx = s2.cx - s1.cx;
54529
54529
  const dy = s2.cy - s1.cy;
54530
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
54531
- const repMag = conf.FG_REPULSION / distSq;
54532
- const fx = dx * repMag;
54533
- const fy = dy * repMag;
54530
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
54531
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
54532
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
54533
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
54534
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
54535
+ const fx = dx / centerDist * repMag;
54536
+ const fy = dy / centerDist * repMag;
54534
54537
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
54535
54538
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
54536
54539
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
package/dist/esm/node.js CHANGED
@@ -5275,8 +5275,8 @@ var conf = {
5275
5275
  FG_SPRING_K: 3,
5276
5276
  FG_TARGET_GAP: 20,
5277
5277
  FG_REPULSION: 400000,
5278
- FG_DAMPING: 0.5,
5279
- FG_SLEEP_THRESHOLD: 2,
5278
+ FG_DAMPING: 0.9,
5279
+ FG_SLEEP_THRESHOLD: 10,
5280
5280
  GRAVITY_G: 80,
5281
5281
  GRAVITY_G_CENTER: 120,
5282
5282
  GRAVITY_DAMPING: 0.96,
@@ -56995,10 +56995,13 @@ class ForceGraphEngine {
56995
56995
  continue;
56996
56996
  const dx = s2.cx - s1.cx;
56997
56997
  const dy = s2.cy - s1.cy;
56998
- const distSq = dx * dx + dy * dy + this.SOFTENING_SQ;
56999
- const repMag = conf.FG_REPULSION / distSq;
57000
- const fx = dx * repMag;
57001
- const fy = dy * repMag;
56998
+ const centerDist = Math.sqrt(dx * dx + dy * dy) + 0.001;
56999
+ const r1 = Math.max(s1.w, s1.h) * 0.5;
57000
+ const r2 = Math.max(s2.w, s2.h) * 0.5;
57001
+ const edgeDist = Math.max(centerDist - r1 - r2, 1);
57002
+ const repMag = conf.FG_REPULSION / (edgeDist * edgeDist + this.SOFTENING_SQ);
57003
+ const fx = dx / centerDist * repMag;
57004
+ const fy = dy / centerDist * repMag;
57002
57005
  ax.set(s1.id, (ax.get(s1.id) ?? 0) - fx);
57003
57006
  ay.set(s1.id, (ay.get(s1.id) ?? 0) - fy);
57004
57007
  ax.set(s2.id, (ax.get(s2.id) ?? 0) + fx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.18",
3
+ "version": "0.13.20",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",