microboard-temp 0.13.22 → 0.13.23

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.
@@ -54662,9 +54662,16 @@ class ForceGraphEngine {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
54664
  wake() {
54665
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
54666
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54665
+ if (this.activeComponents.size === 0)
54666
+ return;
54667
+ const activeIds = this.getActiveNodeIds();
54668
+ for (const item of this.board.items.listAll()) {
54669
+ if (!activeIds.has(item.getId()))
54670
+ continue;
54671
+ const pos = item.transformation.getTranslation();
54672
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54667
54673
  }
54674
+ this.ensureRunning();
54668
54675
  }
54669
54676
  stop() {
54670
54677
  this.stopTimers();
@@ -54750,8 +54757,17 @@ class ForceGraphEngine {
54750
54757
  tick() {
54751
54758
  const dt = this.TICK_MS / 1000;
54752
54759
  const activeIds = this.getActiveNodeIds();
54760
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54753
54761
  const allNodes = this.getNodes();
54754
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
54762
+ const nodes = allNodes.filter((item) => {
54763
+ if (!activeIds.has(item.getId()))
54764
+ return false;
54765
+ if (selectedIds.has(item.getId()))
54766
+ return false;
54767
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
54768
+ return false;
54769
+ return true;
54770
+ });
54755
54771
  if (nodes.length < 1)
54756
54772
  return;
54757
54773
  const snapMap = new Map;
@@ -54850,8 +54866,7 @@ class ForceGraphEngine {
54850
54866
  }
54851
54867
  }
54852
54868
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
54853
- clearInterval(this.tickTimer);
54854
- this.tickTimer = null;
54869
+ this.stopTimers();
54855
54870
  this.syncPositions();
54856
54871
  }
54857
54872
  }
package/dist/cjs/index.js CHANGED
@@ -54662,9 +54662,16 @@ class ForceGraphEngine {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
54664
  wake() {
54665
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
54666
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54665
+ if (this.activeComponents.size === 0)
54666
+ return;
54667
+ const activeIds = this.getActiveNodeIds();
54668
+ for (const item of this.board.items.listAll()) {
54669
+ if (!activeIds.has(item.getId()))
54670
+ continue;
54671
+ const pos = item.transformation.getTranslation();
54672
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54667
54673
  }
54674
+ this.ensureRunning();
54668
54675
  }
54669
54676
  stop() {
54670
54677
  this.stopTimers();
@@ -54750,8 +54757,17 @@ class ForceGraphEngine {
54750
54757
  tick() {
54751
54758
  const dt = this.TICK_MS / 1000;
54752
54759
  const activeIds = this.getActiveNodeIds();
54760
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54753
54761
  const allNodes = this.getNodes();
54754
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
54762
+ const nodes = allNodes.filter((item) => {
54763
+ if (!activeIds.has(item.getId()))
54764
+ return false;
54765
+ if (selectedIds.has(item.getId()))
54766
+ return false;
54767
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
54768
+ return false;
54769
+ return true;
54770
+ });
54755
54771
  if (nodes.length < 1)
54756
54772
  return;
54757
54773
  const snapMap = new Map;
@@ -54850,8 +54866,7 @@ class ForceGraphEngine {
54850
54866
  }
54851
54867
  }
54852
54868
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
54853
- clearInterval(this.tickTimer);
54854
- this.tickTimer = null;
54869
+ this.stopTimers();
54855
54870
  this.syncPositions();
54856
54871
  }
54857
54872
  }
package/dist/cjs/node.js CHANGED
@@ -57135,9 +57135,16 @@ class ForceGraphEngine {
57135
57135
  return this.activeComponents.size > 0;
57136
57136
  }
57137
57137
  wake() {
57138
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
57139
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
57138
+ if (this.activeComponents.size === 0)
57139
+ return;
57140
+ const activeIds = this.getActiveNodeIds();
57141
+ for (const item of this.board.items.listAll()) {
57142
+ if (!activeIds.has(item.getId()))
57143
+ continue;
57144
+ const pos = item.transformation.getTranslation();
57145
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
57140
57146
  }
57147
+ this.ensureRunning();
57141
57148
  }
57142
57149
  stop() {
57143
57150
  this.stopTimers();
@@ -57223,8 +57230,17 @@ class ForceGraphEngine {
57223
57230
  tick() {
57224
57231
  const dt = this.TICK_MS / 1000;
57225
57232
  const activeIds = this.getActiveNodeIds();
57233
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57226
57234
  const allNodes = this.getNodes();
57227
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
57235
+ const nodes = allNodes.filter((item) => {
57236
+ if (!activeIds.has(item.getId()))
57237
+ return false;
57238
+ if (selectedIds.has(item.getId()))
57239
+ return false;
57240
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
57241
+ return false;
57242
+ return true;
57243
+ });
57228
57244
  if (nodes.length < 1)
57229
57245
  return;
57230
57246
  const snapMap = new Map;
@@ -57323,8 +57339,7 @@ class ForceGraphEngine {
57323
57339
  }
57324
57340
  }
57325
57341
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
57326
- clearInterval(this.tickTimer);
57327
- this.tickTimer = null;
57342
+ this.stopTimers();
57328
57343
  this.syncPositions();
57329
57344
  }
57330
57345
  }
@@ -54491,9 +54491,16 @@ class ForceGraphEngine {
54491
54491
  return this.activeComponents.size > 0;
54492
54492
  }
54493
54493
  wake() {
54494
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
54495
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54494
+ if (this.activeComponents.size === 0)
54495
+ return;
54496
+ const activeIds = this.getActiveNodeIds();
54497
+ for (const item of this.board.items.listAll()) {
54498
+ if (!activeIds.has(item.getId()))
54499
+ continue;
54500
+ const pos = item.transformation.getTranslation();
54501
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54496
54502
  }
54503
+ this.ensureRunning();
54497
54504
  }
54498
54505
  stop() {
54499
54506
  this.stopTimers();
@@ -54579,8 +54586,17 @@ class ForceGraphEngine {
54579
54586
  tick() {
54580
54587
  const dt = this.TICK_MS / 1000;
54581
54588
  const activeIds = this.getActiveNodeIds();
54589
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54582
54590
  const allNodes = this.getNodes();
54583
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
54591
+ const nodes = allNodes.filter((item) => {
54592
+ if (!activeIds.has(item.getId()))
54593
+ return false;
54594
+ if (selectedIds.has(item.getId()))
54595
+ return false;
54596
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
54597
+ return false;
54598
+ return true;
54599
+ });
54584
54600
  if (nodes.length < 1)
54585
54601
  return;
54586
54602
  const snapMap = new Map;
@@ -54679,8 +54695,7 @@ class ForceGraphEngine {
54679
54695
  }
54680
54696
  }
54681
54697
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
54682
- clearInterval(this.tickTimer);
54683
- this.tickTimer = null;
54698
+ this.stopTimers();
54684
54699
  this.syncPositions();
54685
54700
  }
54686
54701
  }
package/dist/esm/index.js CHANGED
@@ -54484,9 +54484,16 @@ class ForceGraphEngine {
54484
54484
  return this.activeComponents.size > 0;
54485
54485
  }
54486
54486
  wake() {
54487
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
54488
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
54487
+ if (this.activeComponents.size === 0)
54488
+ return;
54489
+ const activeIds = this.getActiveNodeIds();
54490
+ for (const item of this.board.items.listAll()) {
54491
+ if (!activeIds.has(item.getId()))
54492
+ continue;
54493
+ const pos = item.transformation.getTranslation();
54494
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
54489
54495
  }
54496
+ this.ensureRunning();
54490
54497
  }
54491
54498
  stop() {
54492
54499
  this.stopTimers();
@@ -54572,8 +54579,17 @@ class ForceGraphEngine {
54572
54579
  tick() {
54573
54580
  const dt = this.TICK_MS / 1000;
54574
54581
  const activeIds = this.getActiveNodeIds();
54582
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54575
54583
  const allNodes = this.getNodes();
54576
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
54584
+ const nodes = allNodes.filter((item) => {
54585
+ if (!activeIds.has(item.getId()))
54586
+ return false;
54587
+ if (selectedIds.has(item.getId()))
54588
+ return false;
54589
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
54590
+ return false;
54591
+ return true;
54592
+ });
54577
54593
  if (nodes.length < 1)
54578
54594
  return;
54579
54595
  const snapMap = new Map;
@@ -54672,8 +54688,7 @@ class ForceGraphEngine {
54672
54688
  }
54673
54689
  }
54674
54690
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
54675
- clearInterval(this.tickTimer);
54676
- this.tickTimer = null;
54691
+ this.stopTimers();
54677
54692
  this.syncPositions();
54678
54693
  }
54679
54694
  }
package/dist/esm/node.js CHANGED
@@ -56952,9 +56952,16 @@ class ForceGraphEngine {
56952
56952
  return this.activeComponents.size > 0;
56953
56953
  }
56954
56954
  wake() {
56955
- if (this.activeComponents.size > 0 && this.tickTimer === null) {
56956
- this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
56955
+ if (this.activeComponents.size === 0)
56956
+ return;
56957
+ const activeIds = this.getActiveNodeIds();
56958
+ for (const item of this.board.items.listAll()) {
56959
+ if (!activeIds.has(item.getId()))
56960
+ continue;
56961
+ const pos = item.transformation.getTranslation();
56962
+ this.lastSyncedPositions.set(item.getId(), { x: pos.x, y: pos.y });
56957
56963
  }
56964
+ this.ensureRunning();
56958
56965
  }
56959
56966
  stop() {
56960
56967
  this.stopTimers();
@@ -57040,8 +57047,17 @@ class ForceGraphEngine {
57040
57047
  tick() {
57041
57048
  const dt = this.TICK_MS / 1000;
57042
57049
  const activeIds = this.getActiveNodeIds();
57050
+ const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57043
57051
  const allNodes = this.getNodes();
57044
- const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
57052
+ const nodes = allNodes.filter((item) => {
57053
+ if (!activeIds.has(item.getId()))
57054
+ return false;
57055
+ if (selectedIds.has(item.getId()))
57056
+ return false;
57057
+ if (item.parent !== "Board" && selectedIds.has(item.parent))
57058
+ return false;
57059
+ return true;
57060
+ });
57045
57061
  if (nodes.length < 1)
57046
57062
  return;
57047
57063
  const snapMap = new Map;
@@ -57140,8 +57156,7 @@ class ForceGraphEngine {
57140
57156
  }
57141
57157
  }
57142
57158
  if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
57143
- clearInterval(this.tickTimer);
57144
- this.tickTimer = null;
57159
+ this.stopTimers();
57145
57160
  this.syncPositions();
57146
57161
  }
57147
57162
  }
@@ -30,7 +30,7 @@ export declare class ForceGraphEngine {
30
30
  /** Update the target gap (connector length) for the component containing `nodeId` and re-wake. */
31
31
  setComponentTargetGap(nodeId: string, gap: number): void;
32
32
  hasActiveComponents(): boolean;
33
- /** Re-wake physics after a node is manually dragged. */
33
+ /** Re-wake physics after a node is manually dragged (or targetGap changed). */
34
34
  wake(): void;
35
35
  /** Full stop — called when Board destroys the engine. */
36
36
  stop(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.22",
3
+ "version": "0.13.23",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",