microboard-temp 0.13.23 → 0.13.25

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.
@@ -54661,6 +54661,9 @@ class ForceGraphEngine {
54661
54661
  hasActiveComponents() {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
+ flushSync() {
54665
+ this.syncPositions();
54666
+ }
54664
54667
  wake() {
54665
54668
  if (this.activeComponents.size === 0)
54666
54669
  return;
@@ -54757,14 +54760,14 @@ class ForceGraphEngine {
54757
54760
  tick() {
54758
54761
  const dt = this.TICK_MS / 1000;
54759
54762
  const activeIds = this.getActiveNodeIds();
54760
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54763
+ const draggedIds = this.board.getDraggedItemIds();
54761
54764
  const allNodes = this.getNodes();
54762
54765
  const nodes = allNodes.filter((item) => {
54763
54766
  if (!activeIds.has(item.getId()))
54764
54767
  return false;
54765
- if (selectedIds.has(item.getId()))
54768
+ if (draggedIds.has(item.getId()))
54766
54769
  return false;
54767
- if (item.parent !== "Board" && selectedIds.has(item.parent))
54770
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54768
54771
  return false;
54769
54772
  return true;
54770
54773
  });
@@ -54872,7 +54875,8 @@ class ForceGraphEngine {
54872
54875
  }
54873
54876
  syncPositions() {
54874
54877
  const activeIds = this.getActiveNodeIds();
54875
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54878
+ const draggedIds = this.board.getDraggedItemIds();
54879
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
54876
54880
  if (nodes.length === 0)
54877
54881
  return;
54878
54882
  const movedItems = nodes.map((item) => {
@@ -55994,6 +55998,21 @@ class Board {
55994
55998
  setForceGraphGap(nodeId, gap) {
55995
55999
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55996
56000
  }
56001
+ getDraggedItemIds() {
56002
+ const ids = new Set;
56003
+ if (!this.selection.transformationRenderBlock)
56004
+ return ids;
56005
+ for (const item of this.selection.list())
56006
+ ids.add(item.getId());
56007
+ const selectTool = this.tools.getSelect();
56008
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
56009
+ ids.add(selectTool.downOnItem.getId());
56010
+ }
56011
+ return ids;
56012
+ }
56013
+ syncForceGraph() {
56014
+ this.forceGraph?.flushSync();
56015
+ }
55997
56016
  wakeForceGraph() {
55998
56017
  this.forceGraph?.wake();
55999
56018
  }
package/dist/cjs/index.js CHANGED
@@ -54661,6 +54661,9 @@ class ForceGraphEngine {
54661
54661
  hasActiveComponents() {
54662
54662
  return this.activeComponents.size > 0;
54663
54663
  }
54664
+ flushSync() {
54665
+ this.syncPositions();
54666
+ }
54664
54667
  wake() {
54665
54668
  if (this.activeComponents.size === 0)
54666
54669
  return;
@@ -54757,14 +54760,14 @@ class ForceGraphEngine {
54757
54760
  tick() {
54758
54761
  const dt = this.TICK_MS / 1000;
54759
54762
  const activeIds = this.getActiveNodeIds();
54760
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54763
+ const draggedIds = this.board.getDraggedItemIds();
54761
54764
  const allNodes = this.getNodes();
54762
54765
  const nodes = allNodes.filter((item) => {
54763
54766
  if (!activeIds.has(item.getId()))
54764
54767
  return false;
54765
- if (selectedIds.has(item.getId()))
54768
+ if (draggedIds.has(item.getId()))
54766
54769
  return false;
54767
- if (item.parent !== "Board" && selectedIds.has(item.parent))
54770
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54768
54771
  return false;
54769
54772
  return true;
54770
54773
  });
@@ -54872,7 +54875,8 @@ class ForceGraphEngine {
54872
54875
  }
54873
54876
  syncPositions() {
54874
54877
  const activeIds = this.getActiveNodeIds();
54875
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54878
+ const draggedIds = this.board.getDraggedItemIds();
54879
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
54876
54880
  if (nodes.length === 0)
54877
54881
  return;
54878
54882
  const movedItems = nodes.map((item) => {
@@ -55994,6 +55998,21 @@ class Board {
55994
55998
  setForceGraphGap(nodeId, gap) {
55995
55999
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55996
56000
  }
56001
+ getDraggedItemIds() {
56002
+ const ids = new Set;
56003
+ if (!this.selection.transformationRenderBlock)
56004
+ return ids;
56005
+ for (const item of this.selection.list())
56006
+ ids.add(item.getId());
56007
+ const selectTool = this.tools.getSelect();
56008
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
56009
+ ids.add(selectTool.downOnItem.getId());
56010
+ }
56011
+ return ids;
56012
+ }
56013
+ syncForceGraph() {
56014
+ this.forceGraph?.flushSync();
56015
+ }
55997
56016
  wakeForceGraph() {
55998
56017
  this.forceGraph?.wake();
55999
56018
  }
package/dist/cjs/node.js CHANGED
@@ -57134,6 +57134,9 @@ class ForceGraphEngine {
57134
57134
  hasActiveComponents() {
57135
57135
  return this.activeComponents.size > 0;
57136
57136
  }
57137
+ flushSync() {
57138
+ this.syncPositions();
57139
+ }
57137
57140
  wake() {
57138
57141
  if (this.activeComponents.size === 0)
57139
57142
  return;
@@ -57230,14 +57233,14 @@ class ForceGraphEngine {
57230
57233
  tick() {
57231
57234
  const dt = this.TICK_MS / 1000;
57232
57235
  const activeIds = this.getActiveNodeIds();
57233
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57236
+ const draggedIds = this.board.getDraggedItemIds();
57234
57237
  const allNodes = this.getNodes();
57235
57238
  const nodes = allNodes.filter((item) => {
57236
57239
  if (!activeIds.has(item.getId()))
57237
57240
  return false;
57238
- if (selectedIds.has(item.getId()))
57241
+ if (draggedIds.has(item.getId()))
57239
57242
  return false;
57240
- if (item.parent !== "Board" && selectedIds.has(item.parent))
57243
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
57241
57244
  return false;
57242
57245
  return true;
57243
57246
  });
@@ -57345,7 +57348,8 @@ class ForceGraphEngine {
57345
57348
  }
57346
57349
  syncPositions() {
57347
57350
  const activeIds = this.getActiveNodeIds();
57348
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
57351
+ const draggedIds = this.board.getDraggedItemIds();
57352
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
57349
57353
  if (nodes.length === 0)
57350
57354
  return;
57351
57355
  const movedItems = nodes.map((item) => {
@@ -58467,6 +58471,21 @@ class Board {
58467
58471
  setForceGraphGap(nodeId, gap) {
58468
58472
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
58469
58473
  }
58474
+ getDraggedItemIds() {
58475
+ const ids = new Set;
58476
+ if (!this.selection.transformationRenderBlock)
58477
+ return ids;
58478
+ for (const item of this.selection.list())
58479
+ ids.add(item.getId());
58480
+ const selectTool = this.tools.getSelect();
58481
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
58482
+ ids.add(selectTool.downOnItem.getId());
58483
+ }
58484
+ return ids;
58485
+ }
58486
+ syncForceGraph() {
58487
+ this.forceGraph?.flushSync();
58488
+ }
58470
58489
  wakeForceGraph() {
58471
58490
  this.forceGraph?.wake();
58472
58491
  }
@@ -54490,6 +54490,9 @@ class ForceGraphEngine {
54490
54490
  hasActiveComponents() {
54491
54491
  return this.activeComponents.size > 0;
54492
54492
  }
54493
+ flushSync() {
54494
+ this.syncPositions();
54495
+ }
54493
54496
  wake() {
54494
54497
  if (this.activeComponents.size === 0)
54495
54498
  return;
@@ -54586,14 +54589,14 @@ class ForceGraphEngine {
54586
54589
  tick() {
54587
54590
  const dt = this.TICK_MS / 1000;
54588
54591
  const activeIds = this.getActiveNodeIds();
54589
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54592
+ const draggedIds = this.board.getDraggedItemIds();
54590
54593
  const allNodes = this.getNodes();
54591
54594
  const nodes = allNodes.filter((item) => {
54592
54595
  if (!activeIds.has(item.getId()))
54593
54596
  return false;
54594
- if (selectedIds.has(item.getId()))
54597
+ if (draggedIds.has(item.getId()))
54595
54598
  return false;
54596
- if (item.parent !== "Board" && selectedIds.has(item.parent))
54599
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54597
54600
  return false;
54598
54601
  return true;
54599
54602
  });
@@ -54701,7 +54704,8 @@ class ForceGraphEngine {
54701
54704
  }
54702
54705
  syncPositions() {
54703
54706
  const activeIds = this.getActiveNodeIds();
54704
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54707
+ const draggedIds = this.board.getDraggedItemIds();
54708
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
54705
54709
  if (nodes.length === 0)
54706
54710
  return;
54707
54711
  const movedItems = nodes.map((item) => {
@@ -55823,6 +55827,21 @@ class Board {
55823
55827
  setForceGraphGap(nodeId, gap) {
55824
55828
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55825
55829
  }
55830
+ getDraggedItemIds() {
55831
+ const ids = new Set;
55832
+ if (!this.selection.transformationRenderBlock)
55833
+ return ids;
55834
+ for (const item of this.selection.list())
55835
+ ids.add(item.getId());
55836
+ const selectTool = this.tools.getSelect();
55837
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
55838
+ ids.add(selectTool.downOnItem.getId());
55839
+ }
55840
+ return ids;
55841
+ }
55842
+ syncForceGraph() {
55843
+ this.forceGraph?.flushSync();
55844
+ }
55826
55845
  wakeForceGraph() {
55827
55846
  this.forceGraph?.wake();
55828
55847
  }
package/dist/esm/index.js CHANGED
@@ -54483,6 +54483,9 @@ class ForceGraphEngine {
54483
54483
  hasActiveComponents() {
54484
54484
  return this.activeComponents.size > 0;
54485
54485
  }
54486
+ flushSync() {
54487
+ this.syncPositions();
54488
+ }
54486
54489
  wake() {
54487
54490
  if (this.activeComponents.size === 0)
54488
54491
  return;
@@ -54579,14 +54582,14 @@ class ForceGraphEngine {
54579
54582
  tick() {
54580
54583
  const dt = this.TICK_MS / 1000;
54581
54584
  const activeIds = this.getActiveNodeIds();
54582
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
54585
+ const draggedIds = this.board.getDraggedItemIds();
54583
54586
  const allNodes = this.getNodes();
54584
54587
  const nodes = allNodes.filter((item) => {
54585
54588
  if (!activeIds.has(item.getId()))
54586
54589
  return false;
54587
- if (selectedIds.has(item.getId()))
54590
+ if (draggedIds.has(item.getId()))
54588
54591
  return false;
54589
- if (item.parent !== "Board" && selectedIds.has(item.parent))
54592
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
54590
54593
  return false;
54591
54594
  return true;
54592
54595
  });
@@ -54694,7 +54697,8 @@ class ForceGraphEngine {
54694
54697
  }
54695
54698
  syncPositions() {
54696
54699
  const activeIds = this.getActiveNodeIds();
54697
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
54700
+ const draggedIds = this.board.getDraggedItemIds();
54701
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
54698
54702
  if (nodes.length === 0)
54699
54703
  return;
54700
54704
  const movedItems = nodes.map((item) => {
@@ -55816,6 +55820,21 @@ class Board {
55816
55820
  setForceGraphGap(nodeId, gap) {
55817
55821
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
55818
55822
  }
55823
+ getDraggedItemIds() {
55824
+ const ids = new Set;
55825
+ if (!this.selection.transformationRenderBlock)
55826
+ return ids;
55827
+ for (const item of this.selection.list())
55828
+ ids.add(item.getId());
55829
+ const selectTool = this.tools.getSelect();
55830
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
55831
+ ids.add(selectTool.downOnItem.getId());
55832
+ }
55833
+ return ids;
55834
+ }
55835
+ syncForceGraph() {
55836
+ this.forceGraph?.flushSync();
55837
+ }
55819
55838
  wakeForceGraph() {
55820
55839
  this.forceGraph?.wake();
55821
55840
  }
package/dist/esm/node.js CHANGED
@@ -56951,6 +56951,9 @@ class ForceGraphEngine {
56951
56951
  hasActiveComponents() {
56952
56952
  return this.activeComponents.size > 0;
56953
56953
  }
56954
+ flushSync() {
56955
+ this.syncPositions();
56956
+ }
56954
56957
  wake() {
56955
56958
  if (this.activeComponents.size === 0)
56956
56959
  return;
@@ -57047,14 +57050,14 @@ class ForceGraphEngine {
57047
57050
  tick() {
57048
57051
  const dt = this.TICK_MS / 1000;
57049
57052
  const activeIds = this.getActiveNodeIds();
57050
- const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
57053
+ const draggedIds = this.board.getDraggedItemIds();
57051
57054
  const allNodes = this.getNodes();
57052
57055
  const nodes = allNodes.filter((item) => {
57053
57056
  if (!activeIds.has(item.getId()))
57054
57057
  return false;
57055
- if (selectedIds.has(item.getId()))
57058
+ if (draggedIds.has(item.getId()))
57056
57059
  return false;
57057
- if (item.parent !== "Board" && selectedIds.has(item.parent))
57060
+ if (item.parent !== "Board" && draggedIds.has(item.parent))
57058
57061
  return false;
57059
57062
  return true;
57060
57063
  });
@@ -57162,7 +57165,8 @@ class ForceGraphEngine {
57162
57165
  }
57163
57166
  syncPositions() {
57164
57167
  const activeIds = this.getActiveNodeIds();
57165
- const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
57168
+ const draggedIds = this.board.getDraggedItemIds();
57169
+ const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()) && !draggedIds.has(item.getId()) && !(item.parent !== "Board" && draggedIds.has(item.parent)));
57166
57170
  if (nodes.length === 0)
57167
57171
  return;
57168
57172
  const movedItems = nodes.map((item) => {
@@ -58284,6 +58288,21 @@ class Board {
58284
58288
  setForceGraphGap(nodeId, gap) {
58285
58289
  this.forceGraph?.setComponentTargetGap(nodeId, gap);
58286
58290
  }
58291
+ getDraggedItemIds() {
58292
+ const ids = new Set;
58293
+ if (!this.selection.transformationRenderBlock)
58294
+ return ids;
58295
+ for (const item of this.selection.list())
58296
+ ids.add(item.getId());
58297
+ const selectTool = this.tools.getSelect();
58298
+ if (selectTool?.isDraggingUnselectedItem && selectTool.downOnItem) {
58299
+ ids.add(selectTool.downOnItem.getId());
58300
+ }
58301
+ return ids;
58302
+ }
58303
+ syncForceGraph() {
58304
+ this.forceGraph?.flushSync();
58305
+ }
58287
58306
  wakeForceGraph() {
58288
58307
  this.forceGraph?.wake();
58289
58308
  }
@@ -150,6 +150,13 @@ export declare class Board {
150
150
  getForceGraphGap(nodeId: string): number | undefined;
151
151
  /** Set the connector target gap (px) for the component containing `nodeId`. */
152
152
  setForceGraphGap(nodeId: string, gap: number): void;
153
+ /**
154
+ * Returns IDs of all items currently being dragged (both selected and unselected drag).
155
+ * Used by physics engines to skip items that are under user control.
156
+ */
157
+ getDraggedItemIds(): Set<string>;
158
+ /** Flush pending physics positions to the server immediately (call before drag starts). */
159
+ syncForceGraph(): void;
153
160
  /** Call after dragging a node to re-wake the physics engine if it was sleeping. */
154
161
  wakeForceGraph(): void;
155
162
  }
@@ -30,7 +30,17 @@ 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 (or targetGap changed). */
33
+ /**
34
+ * Flush pending physics positions immediately.
35
+ * Call BEFORE a manual drag starts so the server knows the current physics position
36
+ * before the drag delta is applied on top of it.
37
+ */
38
+ flushSync(): void;
39
+ /**
40
+ * Re-wake physics after a manual drag ends.
41
+ * Resets sync baseline to the post-drag position so the drag delta
42
+ * (already sent by the normal operation system) is not double-counted.
43
+ */
34
44
  wake(): void;
35
45
  /** Full stop — called when Board destroys the engine. */
36
46
  stop(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-temp",
3
- "version": "0.13.23",
3
+ "version": "0.13.25",
4
4
  "description": "A flexible interactive whiteboard library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",