microboard-temp 0.13.21 → 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.
- package/dist/cjs/browser.js +41 -6
- package/dist/cjs/index.js +41 -6
- package/dist/cjs/node.js +41 -6
- package/dist/esm/browser.js +41 -6
- package/dist/esm/index.js +41 -6
- package/dist/esm/node.js +41 -6
- package/dist/types/Board.d.ts +4 -0
- package/dist/types/ForceGraph/ForceGraphEngine.d.ts +5 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -54644,13 +54644,34 @@ class ForceGraphEngine {
|
|
|
54644
54644
|
isNodeInActiveGraph(nodeId) {
|
|
54645
54645
|
return !!this.findComponentId(nodeId);
|
|
54646
54646
|
}
|
|
54647
|
+
getComponentTargetGap(nodeId) {
|
|
54648
|
+
const compId = this.findComponentId(nodeId);
|
|
54649
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
54650
|
+
}
|
|
54651
|
+
setComponentTargetGap(nodeId, gap) {
|
|
54652
|
+
const compId = this.findComponentId(nodeId);
|
|
54653
|
+
if (!compId)
|
|
54654
|
+
return;
|
|
54655
|
+
const comp = this.activeComponents.get(compId);
|
|
54656
|
+
if (!comp)
|
|
54657
|
+
return;
|
|
54658
|
+
comp.targetGap = gap;
|
|
54659
|
+
this.wake();
|
|
54660
|
+
}
|
|
54647
54661
|
hasActiveComponents() {
|
|
54648
54662
|
return this.activeComponents.size > 0;
|
|
54649
54663
|
}
|
|
54650
54664
|
wake() {
|
|
54651
|
-
if (this.activeComponents.size
|
|
54652
|
-
|
|
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 });
|
|
54653
54673
|
}
|
|
54674
|
+
this.ensureRunning();
|
|
54654
54675
|
}
|
|
54655
54676
|
stop() {
|
|
54656
54677
|
this.stopTimers();
|
|
@@ -54717,7 +54738,7 @@ class ForceGraphEngine {
|
|
|
54717
54738
|
count++;
|
|
54718
54739
|
}
|
|
54719
54740
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
54720
|
-
return avgMaxDim *
|
|
54741
|
+
return avgMaxDim * 1.5;
|
|
54721
54742
|
}
|
|
54722
54743
|
getActiveNodeIds() {
|
|
54723
54744
|
const all6 = new Set;
|
|
@@ -54736,8 +54757,17 @@ class ForceGraphEngine {
|
|
|
54736
54757
|
tick() {
|
|
54737
54758
|
const dt = this.TICK_MS / 1000;
|
|
54738
54759
|
const activeIds = this.getActiveNodeIds();
|
|
54760
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
54739
54761
|
const allNodes = this.getNodes();
|
|
54740
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
54741
54771
|
if (nodes.length < 1)
|
|
54742
54772
|
return;
|
|
54743
54773
|
const snapMap = new Map;
|
|
@@ -54836,8 +54866,7 @@ class ForceGraphEngine {
|
|
|
54836
54866
|
}
|
|
54837
54867
|
}
|
|
54838
54868
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
54839
|
-
|
|
54840
|
-
this.tickTimer = null;
|
|
54869
|
+
this.stopTimers();
|
|
54841
54870
|
this.syncPositions();
|
|
54842
54871
|
}
|
|
54843
54872
|
}
|
|
@@ -55959,6 +55988,12 @@ class Board {
|
|
|
55959
55988
|
isNodeInForceGraph(nodeId) {
|
|
55960
55989
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
55961
55990
|
}
|
|
55991
|
+
getForceGraphGap(nodeId) {
|
|
55992
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
55993
|
+
}
|
|
55994
|
+
setForceGraphGap(nodeId, gap) {
|
|
55995
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
55996
|
+
}
|
|
55962
55997
|
wakeForceGraph() {
|
|
55963
55998
|
this.forceGraph?.wake();
|
|
55964
55999
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -54644,13 +54644,34 @@ class ForceGraphEngine {
|
|
|
54644
54644
|
isNodeInActiveGraph(nodeId) {
|
|
54645
54645
|
return !!this.findComponentId(nodeId);
|
|
54646
54646
|
}
|
|
54647
|
+
getComponentTargetGap(nodeId) {
|
|
54648
|
+
const compId = this.findComponentId(nodeId);
|
|
54649
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
54650
|
+
}
|
|
54651
|
+
setComponentTargetGap(nodeId, gap) {
|
|
54652
|
+
const compId = this.findComponentId(nodeId);
|
|
54653
|
+
if (!compId)
|
|
54654
|
+
return;
|
|
54655
|
+
const comp = this.activeComponents.get(compId);
|
|
54656
|
+
if (!comp)
|
|
54657
|
+
return;
|
|
54658
|
+
comp.targetGap = gap;
|
|
54659
|
+
this.wake();
|
|
54660
|
+
}
|
|
54647
54661
|
hasActiveComponents() {
|
|
54648
54662
|
return this.activeComponents.size > 0;
|
|
54649
54663
|
}
|
|
54650
54664
|
wake() {
|
|
54651
|
-
if (this.activeComponents.size
|
|
54652
|
-
|
|
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 });
|
|
54653
54673
|
}
|
|
54674
|
+
this.ensureRunning();
|
|
54654
54675
|
}
|
|
54655
54676
|
stop() {
|
|
54656
54677
|
this.stopTimers();
|
|
@@ -54717,7 +54738,7 @@ class ForceGraphEngine {
|
|
|
54717
54738
|
count++;
|
|
54718
54739
|
}
|
|
54719
54740
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
54720
|
-
return avgMaxDim *
|
|
54741
|
+
return avgMaxDim * 1.5;
|
|
54721
54742
|
}
|
|
54722
54743
|
getActiveNodeIds() {
|
|
54723
54744
|
const all6 = new Set;
|
|
@@ -54736,8 +54757,17 @@ class ForceGraphEngine {
|
|
|
54736
54757
|
tick() {
|
|
54737
54758
|
const dt = this.TICK_MS / 1000;
|
|
54738
54759
|
const activeIds = this.getActiveNodeIds();
|
|
54760
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
54739
54761
|
const allNodes = this.getNodes();
|
|
54740
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
54741
54771
|
if (nodes.length < 1)
|
|
54742
54772
|
return;
|
|
54743
54773
|
const snapMap = new Map;
|
|
@@ -54836,8 +54866,7 @@ class ForceGraphEngine {
|
|
|
54836
54866
|
}
|
|
54837
54867
|
}
|
|
54838
54868
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
54839
|
-
|
|
54840
|
-
this.tickTimer = null;
|
|
54869
|
+
this.stopTimers();
|
|
54841
54870
|
this.syncPositions();
|
|
54842
54871
|
}
|
|
54843
54872
|
}
|
|
@@ -55959,6 +55988,12 @@ class Board {
|
|
|
55959
55988
|
isNodeInForceGraph(nodeId) {
|
|
55960
55989
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
55961
55990
|
}
|
|
55991
|
+
getForceGraphGap(nodeId) {
|
|
55992
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
55993
|
+
}
|
|
55994
|
+
setForceGraphGap(nodeId, gap) {
|
|
55995
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
55996
|
+
}
|
|
55962
55997
|
wakeForceGraph() {
|
|
55963
55998
|
this.forceGraph?.wake();
|
|
55964
55999
|
}
|
package/dist/cjs/node.js
CHANGED
|
@@ -57117,13 +57117,34 @@ class ForceGraphEngine {
|
|
|
57117
57117
|
isNodeInActiveGraph(nodeId) {
|
|
57118
57118
|
return !!this.findComponentId(nodeId);
|
|
57119
57119
|
}
|
|
57120
|
+
getComponentTargetGap(nodeId) {
|
|
57121
|
+
const compId = this.findComponentId(nodeId);
|
|
57122
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
57123
|
+
}
|
|
57124
|
+
setComponentTargetGap(nodeId, gap) {
|
|
57125
|
+
const compId = this.findComponentId(nodeId);
|
|
57126
|
+
if (!compId)
|
|
57127
|
+
return;
|
|
57128
|
+
const comp = this.activeComponents.get(compId);
|
|
57129
|
+
if (!comp)
|
|
57130
|
+
return;
|
|
57131
|
+
comp.targetGap = gap;
|
|
57132
|
+
this.wake();
|
|
57133
|
+
}
|
|
57120
57134
|
hasActiveComponents() {
|
|
57121
57135
|
return this.activeComponents.size > 0;
|
|
57122
57136
|
}
|
|
57123
57137
|
wake() {
|
|
57124
|
-
if (this.activeComponents.size
|
|
57125
|
-
|
|
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 });
|
|
57126
57146
|
}
|
|
57147
|
+
this.ensureRunning();
|
|
57127
57148
|
}
|
|
57128
57149
|
stop() {
|
|
57129
57150
|
this.stopTimers();
|
|
@@ -57190,7 +57211,7 @@ class ForceGraphEngine {
|
|
|
57190
57211
|
count++;
|
|
57191
57212
|
}
|
|
57192
57213
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
57193
|
-
return avgMaxDim *
|
|
57214
|
+
return avgMaxDim * 1.5;
|
|
57194
57215
|
}
|
|
57195
57216
|
getActiveNodeIds() {
|
|
57196
57217
|
const all6 = new Set;
|
|
@@ -57209,8 +57230,17 @@ class ForceGraphEngine {
|
|
|
57209
57230
|
tick() {
|
|
57210
57231
|
const dt = this.TICK_MS / 1000;
|
|
57211
57232
|
const activeIds = this.getActiveNodeIds();
|
|
57233
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
57212
57234
|
const allNodes = this.getNodes();
|
|
57213
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
57214
57244
|
if (nodes.length < 1)
|
|
57215
57245
|
return;
|
|
57216
57246
|
const snapMap = new Map;
|
|
@@ -57309,8 +57339,7 @@ class ForceGraphEngine {
|
|
|
57309
57339
|
}
|
|
57310
57340
|
}
|
|
57311
57341
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
57312
|
-
|
|
57313
|
-
this.tickTimer = null;
|
|
57342
|
+
this.stopTimers();
|
|
57314
57343
|
this.syncPositions();
|
|
57315
57344
|
}
|
|
57316
57345
|
}
|
|
@@ -58432,6 +58461,12 @@ class Board {
|
|
|
58432
58461
|
isNodeInForceGraph(nodeId) {
|
|
58433
58462
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
58434
58463
|
}
|
|
58464
|
+
getForceGraphGap(nodeId) {
|
|
58465
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
58466
|
+
}
|
|
58467
|
+
setForceGraphGap(nodeId, gap) {
|
|
58468
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
58469
|
+
}
|
|
58435
58470
|
wakeForceGraph() {
|
|
58436
58471
|
this.forceGraph?.wake();
|
|
58437
58472
|
}
|
package/dist/esm/browser.js
CHANGED
|
@@ -54473,13 +54473,34 @@ class ForceGraphEngine {
|
|
|
54473
54473
|
isNodeInActiveGraph(nodeId) {
|
|
54474
54474
|
return !!this.findComponentId(nodeId);
|
|
54475
54475
|
}
|
|
54476
|
+
getComponentTargetGap(nodeId) {
|
|
54477
|
+
const compId = this.findComponentId(nodeId);
|
|
54478
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
54479
|
+
}
|
|
54480
|
+
setComponentTargetGap(nodeId, gap) {
|
|
54481
|
+
const compId = this.findComponentId(nodeId);
|
|
54482
|
+
if (!compId)
|
|
54483
|
+
return;
|
|
54484
|
+
const comp = this.activeComponents.get(compId);
|
|
54485
|
+
if (!comp)
|
|
54486
|
+
return;
|
|
54487
|
+
comp.targetGap = gap;
|
|
54488
|
+
this.wake();
|
|
54489
|
+
}
|
|
54476
54490
|
hasActiveComponents() {
|
|
54477
54491
|
return this.activeComponents.size > 0;
|
|
54478
54492
|
}
|
|
54479
54493
|
wake() {
|
|
54480
|
-
if (this.activeComponents.size
|
|
54481
|
-
|
|
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 });
|
|
54482
54502
|
}
|
|
54503
|
+
this.ensureRunning();
|
|
54483
54504
|
}
|
|
54484
54505
|
stop() {
|
|
54485
54506
|
this.stopTimers();
|
|
@@ -54546,7 +54567,7 @@ class ForceGraphEngine {
|
|
|
54546
54567
|
count++;
|
|
54547
54568
|
}
|
|
54548
54569
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
54549
|
-
return avgMaxDim *
|
|
54570
|
+
return avgMaxDim * 1.5;
|
|
54550
54571
|
}
|
|
54551
54572
|
getActiveNodeIds() {
|
|
54552
54573
|
const all6 = new Set;
|
|
@@ -54565,8 +54586,17 @@ class ForceGraphEngine {
|
|
|
54565
54586
|
tick() {
|
|
54566
54587
|
const dt = this.TICK_MS / 1000;
|
|
54567
54588
|
const activeIds = this.getActiveNodeIds();
|
|
54589
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
54568
54590
|
const allNodes = this.getNodes();
|
|
54569
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
54570
54600
|
if (nodes.length < 1)
|
|
54571
54601
|
return;
|
|
54572
54602
|
const snapMap = new Map;
|
|
@@ -54665,8 +54695,7 @@ class ForceGraphEngine {
|
|
|
54665
54695
|
}
|
|
54666
54696
|
}
|
|
54667
54697
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
54668
|
-
|
|
54669
|
-
this.tickTimer = null;
|
|
54698
|
+
this.stopTimers();
|
|
54670
54699
|
this.syncPositions();
|
|
54671
54700
|
}
|
|
54672
54701
|
}
|
|
@@ -55788,6 +55817,12 @@ class Board {
|
|
|
55788
55817
|
isNodeInForceGraph(nodeId) {
|
|
55789
55818
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
55790
55819
|
}
|
|
55820
|
+
getForceGraphGap(nodeId) {
|
|
55821
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
55822
|
+
}
|
|
55823
|
+
setForceGraphGap(nodeId, gap) {
|
|
55824
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
55825
|
+
}
|
|
55791
55826
|
wakeForceGraph() {
|
|
55792
55827
|
this.forceGraph?.wake();
|
|
55793
55828
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -54466,13 +54466,34 @@ class ForceGraphEngine {
|
|
|
54466
54466
|
isNodeInActiveGraph(nodeId) {
|
|
54467
54467
|
return !!this.findComponentId(nodeId);
|
|
54468
54468
|
}
|
|
54469
|
+
getComponentTargetGap(nodeId) {
|
|
54470
|
+
const compId = this.findComponentId(nodeId);
|
|
54471
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
54472
|
+
}
|
|
54473
|
+
setComponentTargetGap(nodeId, gap) {
|
|
54474
|
+
const compId = this.findComponentId(nodeId);
|
|
54475
|
+
if (!compId)
|
|
54476
|
+
return;
|
|
54477
|
+
const comp = this.activeComponents.get(compId);
|
|
54478
|
+
if (!comp)
|
|
54479
|
+
return;
|
|
54480
|
+
comp.targetGap = gap;
|
|
54481
|
+
this.wake();
|
|
54482
|
+
}
|
|
54469
54483
|
hasActiveComponents() {
|
|
54470
54484
|
return this.activeComponents.size > 0;
|
|
54471
54485
|
}
|
|
54472
54486
|
wake() {
|
|
54473
|
-
if (this.activeComponents.size
|
|
54474
|
-
|
|
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 });
|
|
54475
54495
|
}
|
|
54496
|
+
this.ensureRunning();
|
|
54476
54497
|
}
|
|
54477
54498
|
stop() {
|
|
54478
54499
|
this.stopTimers();
|
|
@@ -54539,7 +54560,7 @@ class ForceGraphEngine {
|
|
|
54539
54560
|
count++;
|
|
54540
54561
|
}
|
|
54541
54562
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
54542
|
-
return avgMaxDim *
|
|
54563
|
+
return avgMaxDim * 1.5;
|
|
54543
54564
|
}
|
|
54544
54565
|
getActiveNodeIds() {
|
|
54545
54566
|
const all6 = new Set;
|
|
@@ -54558,8 +54579,17 @@ class ForceGraphEngine {
|
|
|
54558
54579
|
tick() {
|
|
54559
54580
|
const dt = this.TICK_MS / 1000;
|
|
54560
54581
|
const activeIds = this.getActiveNodeIds();
|
|
54582
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
54561
54583
|
const allNodes = this.getNodes();
|
|
54562
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
54563
54593
|
if (nodes.length < 1)
|
|
54564
54594
|
return;
|
|
54565
54595
|
const snapMap = new Map;
|
|
@@ -54658,8 +54688,7 @@ class ForceGraphEngine {
|
|
|
54658
54688
|
}
|
|
54659
54689
|
}
|
|
54660
54690
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
54661
|
-
|
|
54662
|
-
this.tickTimer = null;
|
|
54691
|
+
this.stopTimers();
|
|
54663
54692
|
this.syncPositions();
|
|
54664
54693
|
}
|
|
54665
54694
|
}
|
|
@@ -55781,6 +55810,12 @@ class Board {
|
|
|
55781
55810
|
isNodeInForceGraph(nodeId) {
|
|
55782
55811
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
55783
55812
|
}
|
|
55813
|
+
getForceGraphGap(nodeId) {
|
|
55814
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
55815
|
+
}
|
|
55816
|
+
setForceGraphGap(nodeId, gap) {
|
|
55817
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
55818
|
+
}
|
|
55784
55819
|
wakeForceGraph() {
|
|
55785
55820
|
this.forceGraph?.wake();
|
|
55786
55821
|
}
|
package/dist/esm/node.js
CHANGED
|
@@ -56934,13 +56934,34 @@ class ForceGraphEngine {
|
|
|
56934
56934
|
isNodeInActiveGraph(nodeId) {
|
|
56935
56935
|
return !!this.findComponentId(nodeId);
|
|
56936
56936
|
}
|
|
56937
|
+
getComponentTargetGap(nodeId) {
|
|
56938
|
+
const compId = this.findComponentId(nodeId);
|
|
56939
|
+
return compId ? this.activeComponents.get(compId)?.targetGap : undefined;
|
|
56940
|
+
}
|
|
56941
|
+
setComponentTargetGap(nodeId, gap) {
|
|
56942
|
+
const compId = this.findComponentId(nodeId);
|
|
56943
|
+
if (!compId)
|
|
56944
|
+
return;
|
|
56945
|
+
const comp = this.activeComponents.get(compId);
|
|
56946
|
+
if (!comp)
|
|
56947
|
+
return;
|
|
56948
|
+
comp.targetGap = gap;
|
|
56949
|
+
this.wake();
|
|
56950
|
+
}
|
|
56937
56951
|
hasActiveComponents() {
|
|
56938
56952
|
return this.activeComponents.size > 0;
|
|
56939
56953
|
}
|
|
56940
56954
|
wake() {
|
|
56941
|
-
if (this.activeComponents.size
|
|
56942
|
-
|
|
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 });
|
|
56943
56963
|
}
|
|
56964
|
+
this.ensureRunning();
|
|
56944
56965
|
}
|
|
56945
56966
|
stop() {
|
|
56946
56967
|
this.stopTimers();
|
|
@@ -57007,7 +57028,7 @@ class ForceGraphEngine {
|
|
|
57007
57028
|
count++;
|
|
57008
57029
|
}
|
|
57009
57030
|
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
57010
|
-
return avgMaxDim *
|
|
57031
|
+
return avgMaxDim * 1.5;
|
|
57011
57032
|
}
|
|
57012
57033
|
getActiveNodeIds() {
|
|
57013
57034
|
const all6 = new Set;
|
|
@@ -57026,8 +57047,17 @@ class ForceGraphEngine {
|
|
|
57026
57047
|
tick() {
|
|
57027
57048
|
const dt = this.TICK_MS / 1000;
|
|
57028
57049
|
const activeIds = this.getActiveNodeIds();
|
|
57050
|
+
const selectedIds = new Set(this.board.selection.list().map((i) => i.getId()));
|
|
57029
57051
|
const allNodes = this.getNodes();
|
|
57030
|
-
const nodes = allNodes.filter((item) =>
|
|
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
|
+
});
|
|
57031
57061
|
if (nodes.length < 1)
|
|
57032
57062
|
return;
|
|
57033
57063
|
const snapMap = new Map;
|
|
@@ -57126,8 +57156,7 @@ class ForceGraphEngine {
|
|
|
57126
57156
|
}
|
|
57127
57157
|
}
|
|
57128
57158
|
if (totalEnergy < conf.FG_SLEEP_THRESHOLD && this.tickTimer !== null) {
|
|
57129
|
-
|
|
57130
|
-
this.tickTimer = null;
|
|
57159
|
+
this.stopTimers();
|
|
57131
57160
|
this.syncPositions();
|
|
57132
57161
|
}
|
|
57133
57162
|
}
|
|
@@ -58249,6 +58278,12 @@ class Board {
|
|
|
58249
58278
|
isNodeInForceGraph(nodeId) {
|
|
58250
58279
|
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
58251
58280
|
}
|
|
58281
|
+
getForceGraphGap(nodeId) {
|
|
58282
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
58283
|
+
}
|
|
58284
|
+
setForceGraphGap(nodeId, gap) {
|
|
58285
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
58286
|
+
}
|
|
58252
58287
|
wakeForceGraph() {
|
|
58253
58288
|
this.forceGraph?.wake();
|
|
58254
58289
|
}
|
package/dist/types/Board.d.ts
CHANGED
|
@@ -146,6 +146,10 @@ export declare class Board {
|
|
|
146
146
|
disableForceGraph(nodeId: string): void;
|
|
147
147
|
/** Returns true if `nodeId` is currently in an active force-directed component. */
|
|
148
148
|
isNodeInForceGraph(nodeId: string): boolean;
|
|
149
|
+
/** Get the connector target gap (px) for the component containing `nodeId`. */
|
|
150
|
+
getForceGraphGap(nodeId: string): number | undefined;
|
|
151
|
+
/** Set the connector target gap (px) for the component containing `nodeId`. */
|
|
152
|
+
setForceGraphGap(nodeId: string, gap: number): void;
|
|
149
153
|
/** Call after dragging a node to re-wake the physics engine if it was sleeping. */
|
|
150
154
|
wakeForceGraph(): void;
|
|
151
155
|
}
|
|
@@ -25,8 +25,12 @@ export declare class ForceGraphEngine {
|
|
|
25
25
|
*/
|
|
26
26
|
disableForGraph(nodeId: string): void;
|
|
27
27
|
isNodeInActiveGraph(nodeId: string): boolean;
|
|
28
|
+
/** Get the current target gap for the component containing `nodeId`. Returns undefined if not active. */
|
|
29
|
+
getComponentTargetGap(nodeId: string): number | undefined;
|
|
30
|
+
/** Update the target gap (connector length) for the component containing `nodeId` and re-wake. */
|
|
31
|
+
setComponentTargetGap(nodeId: string, gap: number): void;
|
|
28
32
|
hasActiveComponents(): boolean;
|
|
29
|
-
/** Re-wake physics after a node is manually dragged. */
|
|
33
|
+
/** Re-wake physics after a node is manually dragged (or targetGap changed). */
|
|
30
34
|
wake(): void;
|
|
31
35
|
/** Full stop — called when Board destroys the engine. */
|
|
32
36
|
stop(): void;
|