microboard-temp 0.13.20 → 0.13.22
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 +142 -30
- package/dist/cjs/index.js +142 -30
- package/dist/cjs/node.js +142 -30
- package/dist/esm/browser.js +142 -30
- package/dist/esm/index.js +142 -30
- package/dist/esm/node.js +142 -30
- package/dist/types/Board.d.ts +10 -3
- package/dist/types/ForceGraph/ForceGraphEngine.d.ts +35 -3
- package/package.json +1 -1
package/dist/cjs/node.js
CHANGED
|
@@ -57079,6 +57079,7 @@ class ForceGraphEngine {
|
|
|
57079
57079
|
tickTimer = null;
|
|
57080
57080
|
syncTimer = null;
|
|
57081
57081
|
lastSyncedPositions = new Map;
|
|
57082
|
+
activeComponents = new Map;
|
|
57082
57083
|
TICK_MS = 33;
|
|
57083
57084
|
SYNC_MS = 300;
|
|
57084
57085
|
SOFTENING_SQ = 100 * 100;
|
|
@@ -57086,18 +57087,74 @@ class ForceGraphEngine {
|
|
|
57086
57087
|
constructor(board) {
|
|
57087
57088
|
this.board = board;
|
|
57088
57089
|
}
|
|
57089
|
-
|
|
57090
|
-
if (this.
|
|
57090
|
+
enableForGraph(startNodeId) {
|
|
57091
|
+
if (this.isNodeInActiveGraph(startNodeId))
|
|
57091
57092
|
return;
|
|
57092
|
-
|
|
57093
|
-
|
|
57094
|
-
|
|
57095
|
-
|
|
57093
|
+
const nodeIds = this.bfsComponent(startNodeId);
|
|
57094
|
+
const targetGap = this.calibrateTargetGap(nodeIds);
|
|
57095
|
+
this.activeComponents.set(startNodeId, { nodeIds, targetGap });
|
|
57096
|
+
for (const id of nodeIds) {
|
|
57097
|
+
if (!this.velocities.has(id)) {
|
|
57098
|
+
this.velocities.set(id, { vx: 0, vy: 0 });
|
|
57099
|
+
}
|
|
57100
|
+
const item = this.board.items.getById(id);
|
|
57101
|
+
if (item && !this.lastSyncedPositions.has(id)) {
|
|
57102
|
+
const pos = item.transformation.getTranslation();
|
|
57103
|
+
this.lastSyncedPositions.set(id, { x: pos.x, y: pos.y });
|
|
57104
|
+
}
|
|
57105
|
+
}
|
|
57106
|
+
this.ensureRunning();
|
|
57107
|
+
}
|
|
57108
|
+
disableForGraph(nodeId) {
|
|
57109
|
+
const compId = this.findComponentId(nodeId);
|
|
57110
|
+
if (!compId)
|
|
57111
|
+
return;
|
|
57112
|
+
this.activeComponents.delete(compId);
|
|
57113
|
+
if (this.activeComponents.size === 0) {
|
|
57114
|
+
this.stopTimers();
|
|
57115
|
+
}
|
|
57116
|
+
}
|
|
57117
|
+
isNodeInActiveGraph(nodeId) {
|
|
57118
|
+
return !!this.findComponentId(nodeId);
|
|
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
|
+
}
|
|
57134
|
+
hasActiveComponents() {
|
|
57135
|
+
return this.activeComponents.size > 0;
|
|
57136
|
+
}
|
|
57137
|
+
wake() {
|
|
57138
|
+
if (this.activeComponents.size > 0 && this.tickTimer === null) {
|
|
57139
|
+
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
57096
57140
|
}
|
|
57097
|
-
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
57098
|
-
this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
|
|
57099
57141
|
}
|
|
57100
57142
|
stop() {
|
|
57143
|
+
this.stopTimers();
|
|
57144
|
+
this.syncPositions();
|
|
57145
|
+
this.velocities.clear();
|
|
57146
|
+
this.lastSyncedPositions.clear();
|
|
57147
|
+
this.activeComponents.clear();
|
|
57148
|
+
}
|
|
57149
|
+
ensureRunning() {
|
|
57150
|
+
if (this.tickTimer === null) {
|
|
57151
|
+
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
57152
|
+
}
|
|
57153
|
+
if (this.syncTimer === null) {
|
|
57154
|
+
this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
|
|
57155
|
+
}
|
|
57156
|
+
}
|
|
57157
|
+
stopTimers() {
|
|
57101
57158
|
if (this.tickTimer !== null) {
|
|
57102
57159
|
clearInterval(this.tickTimer);
|
|
57103
57160
|
this.tickTimer = null;
|
|
@@ -57106,9 +57163,56 @@ class ForceGraphEngine {
|
|
|
57106
57163
|
clearInterval(this.syncTimer);
|
|
57107
57164
|
this.syncTimer = null;
|
|
57108
57165
|
}
|
|
57109
|
-
|
|
57110
|
-
|
|
57111
|
-
this.
|
|
57166
|
+
}
|
|
57167
|
+
findComponentId(nodeId) {
|
|
57168
|
+
for (const [compId, { nodeIds }] of this.activeComponents) {
|
|
57169
|
+
if (nodeIds.has(nodeId))
|
|
57170
|
+
return compId;
|
|
57171
|
+
}
|
|
57172
|
+
return;
|
|
57173
|
+
}
|
|
57174
|
+
bfsComponent(startNodeId) {
|
|
57175
|
+
const visited = new Set;
|
|
57176
|
+
const queue = [startNodeId];
|
|
57177
|
+
const connectors = this.getConnectors();
|
|
57178
|
+
while (queue.length > 0) {
|
|
57179
|
+
const nodeId = queue.shift();
|
|
57180
|
+
if (visited.has(nodeId))
|
|
57181
|
+
continue;
|
|
57182
|
+
visited.add(nodeId);
|
|
57183
|
+
for (const connector of connectors) {
|
|
57184
|
+
const { startItem, endItem } = connector.getConnectedItems();
|
|
57185
|
+
if (startItem?.getId() === nodeId && endItem && !visited.has(endItem.getId())) {
|
|
57186
|
+
queue.push(endItem.getId());
|
|
57187
|
+
}
|
|
57188
|
+
if (endItem?.getId() === nodeId && startItem && !visited.has(startItem.getId())) {
|
|
57189
|
+
queue.push(startItem.getId());
|
|
57190
|
+
}
|
|
57191
|
+
}
|
|
57192
|
+
}
|
|
57193
|
+
return visited;
|
|
57194
|
+
}
|
|
57195
|
+
calibrateTargetGap(nodeIds) {
|
|
57196
|
+
let totalMaxDim = 0;
|
|
57197
|
+
let count = 0;
|
|
57198
|
+
for (const id of nodeIds) {
|
|
57199
|
+
const item = this.board.items.getById(id);
|
|
57200
|
+
if (!item)
|
|
57201
|
+
continue;
|
|
57202
|
+
const mbr = item.getMbr();
|
|
57203
|
+
totalMaxDim += Math.max(mbr.getWidth(), mbr.getHeight());
|
|
57204
|
+
count++;
|
|
57205
|
+
}
|
|
57206
|
+
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
57207
|
+
return avgMaxDim * 1.5;
|
|
57208
|
+
}
|
|
57209
|
+
getActiveNodeIds() {
|
|
57210
|
+
const all6 = new Set;
|
|
57211
|
+
for (const { nodeIds } of this.activeComponents.values()) {
|
|
57212
|
+
for (const id of nodeIds)
|
|
57213
|
+
all6.add(id);
|
|
57214
|
+
}
|
|
57215
|
+
return all6;
|
|
57112
57216
|
}
|
|
57113
57217
|
getNodes() {
|
|
57114
57218
|
return this.board.items.listAll().filter((item) => !EXCLUDED_TYPES.has(item.itemType) && !item.transformation.isLocked);
|
|
@@ -57118,8 +57222,10 @@ class ForceGraphEngine {
|
|
|
57118
57222
|
}
|
|
57119
57223
|
tick() {
|
|
57120
57224
|
const dt = this.TICK_MS / 1000;
|
|
57121
|
-
const
|
|
57122
|
-
|
|
57225
|
+
const activeIds = this.getActiveNodeIds();
|
|
57226
|
+
const allNodes = this.getNodes();
|
|
57227
|
+
const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
|
|
57228
|
+
if (nodes.length < 1)
|
|
57123
57229
|
return;
|
|
57124
57230
|
const snapMap = new Map;
|
|
57125
57231
|
for (const item of nodes) {
|
|
@@ -57160,7 +57266,9 @@ class ForceGraphEngine {
|
|
|
57160
57266
|
const dx = s2.cx - s1.cx;
|
|
57161
57267
|
const dy = s2.cy - s1.cy;
|
|
57162
57268
|
const dist = Math.sqrt(dx * dx + dy * dy) + 0.001;
|
|
57163
|
-
const
|
|
57269
|
+
const compId = this.findComponentId(s1.id);
|
|
57270
|
+
const targetGap = compId ? this.activeComponents.get(compId)?.targetGap ?? conf.FG_TARGET_GAP : conf.FG_TARGET_GAP;
|
|
57271
|
+
const targetDist = (Math.max(s1.w, s1.h) + Math.max(s2.w, s2.h)) * 0.5 + targetGap;
|
|
57164
57272
|
const stretch = dist - targetDist;
|
|
57165
57273
|
const forceMag = stretch * conf.FG_SPRING_K;
|
|
57166
57274
|
const fx = dx / dist * forceMag;
|
|
@@ -57221,7 +57329,8 @@ class ForceGraphEngine {
|
|
|
57221
57329
|
}
|
|
57222
57330
|
}
|
|
57223
57331
|
syncPositions() {
|
|
57224
|
-
const
|
|
57332
|
+
const activeIds = this.getActiveNodeIds();
|
|
57333
|
+
const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
|
|
57225
57334
|
if (nodes.length === 0)
|
|
57226
57335
|
return;
|
|
57227
57336
|
const movedItems = nodes.map((item) => {
|
|
@@ -57245,11 +57354,6 @@ class ForceGraphEngine {
|
|
|
57245
57354
|
};
|
|
57246
57355
|
this.board.events.emit(operation);
|
|
57247
57356
|
}
|
|
57248
|
-
wake() {
|
|
57249
|
-
if (this.tickTimer === null && this.syncTimer !== null) {
|
|
57250
|
-
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
57251
|
-
}
|
|
57252
|
-
}
|
|
57253
57357
|
}
|
|
57254
57358
|
|
|
57255
57359
|
// src/Board.ts
|
|
@@ -58325,20 +58429,28 @@ class Board {
|
|
|
58325
58429
|
return this.gravity !== null;
|
|
58326
58430
|
}
|
|
58327
58431
|
forceGraph = null;
|
|
58328
|
-
enableForceGraph() {
|
|
58329
|
-
if (this.forceGraph)
|
|
58330
|
-
|
|
58331
|
-
|
|
58332
|
-
this.forceGraph.
|
|
58432
|
+
enableForceGraph(nodeId) {
|
|
58433
|
+
if (!this.forceGraph) {
|
|
58434
|
+
this.forceGraph = new ForceGraphEngine(this);
|
|
58435
|
+
}
|
|
58436
|
+
this.forceGraph.enableForGraph(nodeId);
|
|
58333
58437
|
}
|
|
58334
|
-
disableForceGraph() {
|
|
58438
|
+
disableForceGraph(nodeId) {
|
|
58335
58439
|
if (!this.forceGraph)
|
|
58336
58440
|
return;
|
|
58337
|
-
this.forceGraph.
|
|
58338
|
-
this.forceGraph
|
|
58441
|
+
this.forceGraph.disableForGraph(nodeId);
|
|
58442
|
+
if (!this.forceGraph.hasActiveComponents()) {
|
|
58443
|
+
this.forceGraph = null;
|
|
58444
|
+
}
|
|
58445
|
+
}
|
|
58446
|
+
isNodeInForceGraph(nodeId) {
|
|
58447
|
+
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
58448
|
+
}
|
|
58449
|
+
getForceGraphGap(nodeId) {
|
|
58450
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
58339
58451
|
}
|
|
58340
|
-
|
|
58341
|
-
|
|
58452
|
+
setForceGraphGap(nodeId, gap) {
|
|
58453
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
58342
58454
|
}
|
|
58343
58455
|
wakeForceGraph() {
|
|
58344
58456
|
this.forceGraph?.wake();
|
package/dist/esm/browser.js
CHANGED
|
@@ -54435,6 +54435,7 @@ class ForceGraphEngine {
|
|
|
54435
54435
|
tickTimer = null;
|
|
54436
54436
|
syncTimer = null;
|
|
54437
54437
|
lastSyncedPositions = new Map;
|
|
54438
|
+
activeComponents = new Map;
|
|
54438
54439
|
TICK_MS = 33;
|
|
54439
54440
|
SYNC_MS = 300;
|
|
54440
54441
|
SOFTENING_SQ = 100 * 100;
|
|
@@ -54442,18 +54443,74 @@ class ForceGraphEngine {
|
|
|
54442
54443
|
constructor(board) {
|
|
54443
54444
|
this.board = board;
|
|
54444
54445
|
}
|
|
54445
|
-
|
|
54446
|
-
if (this.
|
|
54446
|
+
enableForGraph(startNodeId) {
|
|
54447
|
+
if (this.isNodeInActiveGraph(startNodeId))
|
|
54447
54448
|
return;
|
|
54448
|
-
|
|
54449
|
-
|
|
54450
|
-
|
|
54451
|
-
|
|
54449
|
+
const nodeIds = this.bfsComponent(startNodeId);
|
|
54450
|
+
const targetGap = this.calibrateTargetGap(nodeIds);
|
|
54451
|
+
this.activeComponents.set(startNodeId, { nodeIds, targetGap });
|
|
54452
|
+
for (const id of nodeIds) {
|
|
54453
|
+
if (!this.velocities.has(id)) {
|
|
54454
|
+
this.velocities.set(id, { vx: 0, vy: 0 });
|
|
54455
|
+
}
|
|
54456
|
+
const item = this.board.items.getById(id);
|
|
54457
|
+
if (item && !this.lastSyncedPositions.has(id)) {
|
|
54458
|
+
const pos = item.transformation.getTranslation();
|
|
54459
|
+
this.lastSyncedPositions.set(id, { x: pos.x, y: pos.y });
|
|
54460
|
+
}
|
|
54461
|
+
}
|
|
54462
|
+
this.ensureRunning();
|
|
54463
|
+
}
|
|
54464
|
+
disableForGraph(nodeId) {
|
|
54465
|
+
const compId = this.findComponentId(nodeId);
|
|
54466
|
+
if (!compId)
|
|
54467
|
+
return;
|
|
54468
|
+
this.activeComponents.delete(compId);
|
|
54469
|
+
if (this.activeComponents.size === 0) {
|
|
54470
|
+
this.stopTimers();
|
|
54471
|
+
}
|
|
54472
|
+
}
|
|
54473
|
+
isNodeInActiveGraph(nodeId) {
|
|
54474
|
+
return !!this.findComponentId(nodeId);
|
|
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
|
+
}
|
|
54490
|
+
hasActiveComponents() {
|
|
54491
|
+
return this.activeComponents.size > 0;
|
|
54492
|
+
}
|
|
54493
|
+
wake() {
|
|
54494
|
+
if (this.activeComponents.size > 0 && this.tickTimer === null) {
|
|
54495
|
+
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
54452
54496
|
}
|
|
54453
|
-
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
54454
|
-
this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
|
|
54455
54497
|
}
|
|
54456
54498
|
stop() {
|
|
54499
|
+
this.stopTimers();
|
|
54500
|
+
this.syncPositions();
|
|
54501
|
+
this.velocities.clear();
|
|
54502
|
+
this.lastSyncedPositions.clear();
|
|
54503
|
+
this.activeComponents.clear();
|
|
54504
|
+
}
|
|
54505
|
+
ensureRunning() {
|
|
54506
|
+
if (this.tickTimer === null) {
|
|
54507
|
+
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
54508
|
+
}
|
|
54509
|
+
if (this.syncTimer === null) {
|
|
54510
|
+
this.syncTimer = setInterval(() => this.syncPositions(), this.SYNC_MS);
|
|
54511
|
+
}
|
|
54512
|
+
}
|
|
54513
|
+
stopTimers() {
|
|
54457
54514
|
if (this.tickTimer !== null) {
|
|
54458
54515
|
clearInterval(this.tickTimer);
|
|
54459
54516
|
this.tickTimer = null;
|
|
@@ -54462,9 +54519,56 @@ class ForceGraphEngine {
|
|
|
54462
54519
|
clearInterval(this.syncTimer);
|
|
54463
54520
|
this.syncTimer = null;
|
|
54464
54521
|
}
|
|
54465
|
-
|
|
54466
|
-
|
|
54467
|
-
this.
|
|
54522
|
+
}
|
|
54523
|
+
findComponentId(nodeId) {
|
|
54524
|
+
for (const [compId, { nodeIds }] of this.activeComponents) {
|
|
54525
|
+
if (nodeIds.has(nodeId))
|
|
54526
|
+
return compId;
|
|
54527
|
+
}
|
|
54528
|
+
return;
|
|
54529
|
+
}
|
|
54530
|
+
bfsComponent(startNodeId) {
|
|
54531
|
+
const visited = new Set;
|
|
54532
|
+
const queue = [startNodeId];
|
|
54533
|
+
const connectors = this.getConnectors();
|
|
54534
|
+
while (queue.length > 0) {
|
|
54535
|
+
const nodeId = queue.shift();
|
|
54536
|
+
if (visited.has(nodeId))
|
|
54537
|
+
continue;
|
|
54538
|
+
visited.add(nodeId);
|
|
54539
|
+
for (const connector of connectors) {
|
|
54540
|
+
const { startItem, endItem } = connector.getConnectedItems();
|
|
54541
|
+
if (startItem?.getId() === nodeId && endItem && !visited.has(endItem.getId())) {
|
|
54542
|
+
queue.push(endItem.getId());
|
|
54543
|
+
}
|
|
54544
|
+
if (endItem?.getId() === nodeId && startItem && !visited.has(startItem.getId())) {
|
|
54545
|
+
queue.push(startItem.getId());
|
|
54546
|
+
}
|
|
54547
|
+
}
|
|
54548
|
+
}
|
|
54549
|
+
return visited;
|
|
54550
|
+
}
|
|
54551
|
+
calibrateTargetGap(nodeIds) {
|
|
54552
|
+
let totalMaxDim = 0;
|
|
54553
|
+
let count = 0;
|
|
54554
|
+
for (const id of nodeIds) {
|
|
54555
|
+
const item = this.board.items.getById(id);
|
|
54556
|
+
if (!item)
|
|
54557
|
+
continue;
|
|
54558
|
+
const mbr = item.getMbr();
|
|
54559
|
+
totalMaxDim += Math.max(mbr.getWidth(), mbr.getHeight());
|
|
54560
|
+
count++;
|
|
54561
|
+
}
|
|
54562
|
+
const avgMaxDim = count > 0 ? totalMaxDim / count : 100;
|
|
54563
|
+
return avgMaxDim * 1.5;
|
|
54564
|
+
}
|
|
54565
|
+
getActiveNodeIds() {
|
|
54566
|
+
const all6 = new Set;
|
|
54567
|
+
for (const { nodeIds } of this.activeComponents.values()) {
|
|
54568
|
+
for (const id of nodeIds)
|
|
54569
|
+
all6.add(id);
|
|
54570
|
+
}
|
|
54571
|
+
return all6;
|
|
54468
54572
|
}
|
|
54469
54573
|
getNodes() {
|
|
54470
54574
|
return this.board.items.listAll().filter((item) => !EXCLUDED_TYPES.has(item.itemType) && !item.transformation.isLocked);
|
|
@@ -54474,8 +54578,10 @@ class ForceGraphEngine {
|
|
|
54474
54578
|
}
|
|
54475
54579
|
tick() {
|
|
54476
54580
|
const dt = this.TICK_MS / 1000;
|
|
54477
|
-
const
|
|
54478
|
-
|
|
54581
|
+
const activeIds = this.getActiveNodeIds();
|
|
54582
|
+
const allNodes = this.getNodes();
|
|
54583
|
+
const nodes = allNodes.filter((item) => activeIds.has(item.getId()));
|
|
54584
|
+
if (nodes.length < 1)
|
|
54479
54585
|
return;
|
|
54480
54586
|
const snapMap = new Map;
|
|
54481
54587
|
for (const item of nodes) {
|
|
@@ -54516,7 +54622,9 @@ class ForceGraphEngine {
|
|
|
54516
54622
|
const dx = s2.cx - s1.cx;
|
|
54517
54623
|
const dy = s2.cy - s1.cy;
|
|
54518
54624
|
const dist = Math.sqrt(dx * dx + dy * dy) + 0.001;
|
|
54519
|
-
const
|
|
54625
|
+
const compId = this.findComponentId(s1.id);
|
|
54626
|
+
const targetGap = compId ? this.activeComponents.get(compId)?.targetGap ?? conf.FG_TARGET_GAP : conf.FG_TARGET_GAP;
|
|
54627
|
+
const targetDist = (Math.max(s1.w, s1.h) + Math.max(s2.w, s2.h)) * 0.5 + targetGap;
|
|
54520
54628
|
const stretch = dist - targetDist;
|
|
54521
54629
|
const forceMag = stretch * conf.FG_SPRING_K;
|
|
54522
54630
|
const fx = dx / dist * forceMag;
|
|
@@ -54577,7 +54685,8 @@ class ForceGraphEngine {
|
|
|
54577
54685
|
}
|
|
54578
54686
|
}
|
|
54579
54687
|
syncPositions() {
|
|
54580
|
-
const
|
|
54688
|
+
const activeIds = this.getActiveNodeIds();
|
|
54689
|
+
const nodes = this.getNodes().filter((item) => activeIds.has(item.getId()));
|
|
54581
54690
|
if (nodes.length === 0)
|
|
54582
54691
|
return;
|
|
54583
54692
|
const movedItems = nodes.map((item) => {
|
|
@@ -54601,11 +54710,6 @@ class ForceGraphEngine {
|
|
|
54601
54710
|
};
|
|
54602
54711
|
this.board.events.emit(operation);
|
|
54603
54712
|
}
|
|
54604
|
-
wake() {
|
|
54605
|
-
if (this.tickTimer === null && this.syncTimer !== null) {
|
|
54606
|
-
this.tickTimer = setInterval(() => this.tick(), this.TICK_MS);
|
|
54607
|
-
}
|
|
54608
|
-
}
|
|
54609
54713
|
}
|
|
54610
54714
|
|
|
54611
54715
|
// src/Board.ts
|
|
@@ -55681,20 +55785,28 @@ class Board {
|
|
|
55681
55785
|
return this.gravity !== null;
|
|
55682
55786
|
}
|
|
55683
55787
|
forceGraph = null;
|
|
55684
|
-
enableForceGraph() {
|
|
55685
|
-
if (this.forceGraph)
|
|
55686
|
-
|
|
55687
|
-
|
|
55688
|
-
this.forceGraph.
|
|
55788
|
+
enableForceGraph(nodeId) {
|
|
55789
|
+
if (!this.forceGraph) {
|
|
55790
|
+
this.forceGraph = new ForceGraphEngine(this);
|
|
55791
|
+
}
|
|
55792
|
+
this.forceGraph.enableForGraph(nodeId);
|
|
55689
55793
|
}
|
|
55690
|
-
disableForceGraph() {
|
|
55794
|
+
disableForceGraph(nodeId) {
|
|
55691
55795
|
if (!this.forceGraph)
|
|
55692
55796
|
return;
|
|
55693
|
-
this.forceGraph.
|
|
55694
|
-
this.forceGraph
|
|
55797
|
+
this.forceGraph.disableForGraph(nodeId);
|
|
55798
|
+
if (!this.forceGraph.hasActiveComponents()) {
|
|
55799
|
+
this.forceGraph = null;
|
|
55800
|
+
}
|
|
55801
|
+
}
|
|
55802
|
+
isNodeInForceGraph(nodeId) {
|
|
55803
|
+
return this.forceGraph?.isNodeInActiveGraph(nodeId) ?? false;
|
|
55804
|
+
}
|
|
55805
|
+
getForceGraphGap(nodeId) {
|
|
55806
|
+
return this.forceGraph?.getComponentTargetGap(nodeId);
|
|
55695
55807
|
}
|
|
55696
|
-
|
|
55697
|
-
|
|
55808
|
+
setForceGraphGap(nodeId, gap) {
|
|
55809
|
+
this.forceGraph?.setComponentTargetGap(nodeId, gap);
|
|
55698
55810
|
}
|
|
55699
55811
|
wakeForceGraph() {
|
|
55700
55812
|
this.forceGraph?.wake();
|