microboard-temp 0.13.74 → 0.13.75

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.
@@ -3962,6 +3962,7 @@ var init_Settings = __esm(() => {
3962
3962
  FG_DAMPING: 0.6,
3963
3963
  FG_SLEEP_THRESHOLD: 10,
3964
3964
  FG_TICK_MS: 16,
3965
+ FG_ALIGN_K: 0.05,
3965
3966
  GRAVITY_G: 80,
3966
3967
  GRAVITY_G_CENTER: 120,
3967
3968
  GRAVITY_DAMPING: 0.96,
@@ -75755,6 +75756,28 @@ class ForceGraphEngine {
75755
75756
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75756
75757
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75757
75758
  }
75759
+ if (conf.FG_ALIGN_K > 0) {
75760
+ for (const connector of this.getConnectors()) {
75761
+ const { startItem, endItem } = connector.getConnectedItems();
75762
+ if (!startItem || !endItem)
75763
+ continue;
75764
+ const s1 = snapMap.get(startItem.getId());
75765
+ const s2 = snapMap.get(endItem.getId());
75766
+ if (!s1 || !s2)
75767
+ continue;
75768
+ const dx = s2.cx - s1.cx;
75769
+ const dy = s2.cy - s1.cy;
75770
+ if (Math.abs(dx) >= Math.abs(dy)) {
75771
+ const fy = dy * conf.FG_ALIGN_K;
75772
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
75773
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75774
+ } else {
75775
+ const fx = dx * conf.FG_ALIGN_K;
75776
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
75777
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75778
+ }
75779
+ }
75780
+ }
75758
75781
  for (let i = 0;i < snap.length; i++) {
75759
75782
  for (let j = i + 1;j < snap.length; j++) {
75760
75783
  const s1 = snap[i];
package/dist/cjs/index.js CHANGED
@@ -3962,6 +3962,7 @@ var init_Settings = __esm(() => {
3962
3962
  FG_DAMPING: 0.6,
3963
3963
  FG_SLEEP_THRESHOLD: 10,
3964
3964
  FG_TICK_MS: 16,
3965
+ FG_ALIGN_K: 0.05,
3965
3966
  GRAVITY_G: 80,
3966
3967
  GRAVITY_G_CENTER: 120,
3967
3968
  GRAVITY_DAMPING: 0.96,
@@ -75755,6 +75756,28 @@ class ForceGraphEngine {
75755
75756
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75756
75757
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75757
75758
  }
75759
+ if (conf.FG_ALIGN_K > 0) {
75760
+ for (const connector of this.getConnectors()) {
75761
+ const { startItem, endItem } = connector.getConnectedItems();
75762
+ if (!startItem || !endItem)
75763
+ continue;
75764
+ const s1 = snapMap.get(startItem.getId());
75765
+ const s2 = snapMap.get(endItem.getId());
75766
+ if (!s1 || !s2)
75767
+ continue;
75768
+ const dx = s2.cx - s1.cx;
75769
+ const dy = s2.cy - s1.cy;
75770
+ if (Math.abs(dx) >= Math.abs(dy)) {
75771
+ const fy = dy * conf.FG_ALIGN_K;
75772
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
75773
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75774
+ } else {
75775
+ const fx = dx * conf.FG_ALIGN_K;
75776
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
75777
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75778
+ }
75779
+ }
75780
+ }
75758
75781
  for (let i = 0;i < snap.length; i++) {
75759
75782
  for (let j = i + 1;j < snap.length; j++) {
75760
75783
  const s1 = snap[i];
package/dist/cjs/node.js CHANGED
@@ -3962,6 +3962,7 @@ var init_Settings = __esm(() => {
3962
3962
  FG_DAMPING: 0.6,
3963
3963
  FG_SLEEP_THRESHOLD: 10,
3964
3964
  FG_TICK_MS: 16,
3965
+ FG_ALIGN_K: 0.05,
3965
3966
  GRAVITY_G: 80,
3966
3967
  GRAVITY_G_CENTER: 120,
3967
3968
  GRAVITY_DAMPING: 0.96,
@@ -78230,6 +78231,28 @@ class ForceGraphEngine {
78230
78231
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
78231
78232
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
78232
78233
  }
78234
+ if (conf.FG_ALIGN_K > 0) {
78235
+ for (const connector of this.getConnectors()) {
78236
+ const { startItem, endItem } = connector.getConnectedItems();
78237
+ if (!startItem || !endItem)
78238
+ continue;
78239
+ const s1 = snapMap.get(startItem.getId());
78240
+ const s2 = snapMap.get(endItem.getId());
78241
+ if (!s1 || !s2)
78242
+ continue;
78243
+ const dx = s2.cx - s1.cx;
78244
+ const dy = s2.cy - s1.cy;
78245
+ if (Math.abs(dx) >= Math.abs(dy)) {
78246
+ const fy = dy * conf.FG_ALIGN_K;
78247
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
78248
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
78249
+ } else {
78250
+ const fx = dx * conf.FG_ALIGN_K;
78251
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
78252
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
78253
+ }
78254
+ }
78255
+ }
78233
78256
  for (let i = 0;i < snap.length; i++) {
78234
78257
  for (let j = i + 1;j < snap.length; j++) {
78235
78258
  const s1 = snap[i];
@@ -3969,6 +3969,7 @@ var init_Settings = __esm(() => {
3969
3969
  FG_DAMPING: 0.6,
3970
3970
  FG_SLEEP_THRESHOLD: 10,
3971
3971
  FG_TICK_MS: 16,
3972
+ FG_ALIGN_K: 0.05,
3972
3973
  GRAVITY_G: 80,
3973
3974
  GRAVITY_G_CENTER: 120,
3974
3975
  GRAVITY_DAMPING: 0.96,
@@ -75499,6 +75500,28 @@ class ForceGraphEngine {
75499
75500
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75500
75501
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75501
75502
  }
75503
+ if (conf.FG_ALIGN_K > 0) {
75504
+ for (const connector of this.getConnectors()) {
75505
+ const { startItem, endItem } = connector.getConnectedItems();
75506
+ if (!startItem || !endItem)
75507
+ continue;
75508
+ const s1 = snapMap.get(startItem.getId());
75509
+ const s2 = snapMap.get(endItem.getId());
75510
+ if (!s1 || !s2)
75511
+ continue;
75512
+ const dx = s2.cx - s1.cx;
75513
+ const dy = s2.cy - s1.cy;
75514
+ if (Math.abs(dx) >= Math.abs(dy)) {
75515
+ const fy = dy * conf.FG_ALIGN_K;
75516
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
75517
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75518
+ } else {
75519
+ const fx = dx * conf.FG_ALIGN_K;
75520
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
75521
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75522
+ }
75523
+ }
75524
+ }
75502
75525
  for (let i = 0;i < snap.length; i++) {
75503
75526
  for (let j = i + 1;j < snap.length; j++) {
75504
75527
  const s1 = snap[i];
package/dist/esm/index.js CHANGED
@@ -3962,6 +3962,7 @@ var init_Settings = __esm(() => {
3962
3962
  FG_DAMPING: 0.6,
3963
3963
  FG_SLEEP_THRESHOLD: 10,
3964
3964
  FG_TICK_MS: 16,
3965
+ FG_ALIGN_K: 0.05,
3965
3966
  GRAVITY_G: 80,
3966
3967
  GRAVITY_G_CENTER: 120,
3967
3968
  GRAVITY_DAMPING: 0.96,
@@ -75492,6 +75493,28 @@ class ForceGraphEngine {
75492
75493
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75493
75494
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75494
75495
  }
75496
+ if (conf.FG_ALIGN_K > 0) {
75497
+ for (const connector of this.getConnectors()) {
75498
+ const { startItem, endItem } = connector.getConnectedItems();
75499
+ if (!startItem || !endItem)
75500
+ continue;
75501
+ const s1 = snapMap.get(startItem.getId());
75502
+ const s2 = snapMap.get(endItem.getId());
75503
+ if (!s1 || !s2)
75504
+ continue;
75505
+ const dx = s2.cx - s1.cx;
75506
+ const dy = s2.cy - s1.cy;
75507
+ if (Math.abs(dx) >= Math.abs(dy)) {
75508
+ const fy = dy * conf.FG_ALIGN_K;
75509
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
75510
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
75511
+ } else {
75512
+ const fx = dx * conf.FG_ALIGN_K;
75513
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
75514
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
75515
+ }
75516
+ }
75517
+ }
75495
75518
  for (let i = 0;i < snap.length; i++) {
75496
75519
  for (let j = i + 1;j < snap.length; j++) {
75497
75520
  const s1 = snap[i];
package/dist/esm/node.js CHANGED
@@ -3964,6 +3964,7 @@ var init_Settings = __esm(() => {
3964
3964
  FG_DAMPING: 0.6,
3965
3965
  FG_SLEEP_THRESHOLD: 10,
3966
3966
  FG_TICK_MS: 16,
3967
+ FG_ALIGN_K: 0.05,
3967
3968
  GRAVITY_G: 80,
3968
3969
  GRAVITY_G_CENTER: 120,
3969
3970
  GRAVITY_DAMPING: 0.96,
@@ -77956,6 +77957,28 @@ class ForceGraphEngine {
77956
77957
  ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
77957
77958
  ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
77958
77959
  }
77960
+ if (conf.FG_ALIGN_K > 0) {
77961
+ for (const connector of this.getConnectors()) {
77962
+ const { startItem, endItem } = connector.getConnectedItems();
77963
+ if (!startItem || !endItem)
77964
+ continue;
77965
+ const s1 = snapMap.get(startItem.getId());
77966
+ const s2 = snapMap.get(endItem.getId());
77967
+ if (!s1 || !s2)
77968
+ continue;
77969
+ const dx = s2.cx - s1.cx;
77970
+ const dy = s2.cy - s1.cy;
77971
+ if (Math.abs(dx) >= Math.abs(dy)) {
77972
+ const fy = dy * conf.FG_ALIGN_K;
77973
+ ay.set(s1.id, (ay.get(s1.id) ?? 0) + fy);
77974
+ ay.set(s2.id, (ay.get(s2.id) ?? 0) - fy);
77975
+ } else {
77976
+ const fx = dx * conf.FG_ALIGN_K;
77977
+ ax.set(s1.id, (ax.get(s1.id) ?? 0) + fx);
77978
+ ax.set(s2.id, (ax.get(s2.id) ?? 0) - fx);
77979
+ }
77980
+ }
77981
+ }
77959
77982
  for (let i = 0;i < snap.length; i++) {
77960
77983
  for (let j = i + 1;j < snap.length; j++) {
77961
77984
  const s1 = snap[i];
@@ -264,6 +264,7 @@ export declare const conf: {
264
264
  FG_DAMPING: number;
265
265
  FG_SLEEP_THRESHOLD: number;
266
266
  FG_TICK_MS: number;
267
+ FG_ALIGN_K: number;
267
268
  GRAVITY_G: number;
268
269
  GRAVITY_G_CENTER: number;
269
270
  GRAVITY_DAMPING: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.74",
3
+ "version": "0.13.75",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",