Skip to content

Commit 9f05420

Browse files
committed
Various refactoring
1 parent cb43d18 commit 9f05420

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

src/commands/showComponentHierarchy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export class ShowComponentHierarchy extends ShowHierarchyBase {
2626
return;
2727
case 'setGraphState':
2828
const newGraphState: GraphState = JSON.parse(message.text);
29-
this.graphState.networkSeed = newGraphState.networkSeed;
30-
this.graphState.nodePositions = newGraphState.nodePositions;
29+
this.graphState = newGraphState;
3130
this.setNewState(this.graphState);
3231
return;
3332
}

src/commands/showModuleHierarchy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export class ShowModuleHierarchy extends ShowHierarchyBase {
2323
return;
2424
case 'setGraphState':
2525
const newGraphState: GraphState = JSON.parse(message.text);
26-
this.graphState.networkSeed = newGraphState.networkSeed;
27-
this.graphState.nodePositions = newGraphState.nodePositions;
26+
this.graphState = newGraphState;
2827
this.setNewState(this.graphState);
2928
return;
3029
}

templates/showHierarchy_Template.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@
3737
network.setOptions({
3838
physics: false
3939
});
40-
nodes.forEach(function (node) {
41-
nodes.update({
42-
id: node.id,
43-
fixed: false
44-
});
45-
});
40+
unfixNodes();
4641
postGraphState();
4742
});
4843
network.on('dragEnd', postGraphState);
@@ -375,12 +370,7 @@
375370
network.setOptions({
376371
physics: false
377372
});
378-
nodes.forEach(function (node) {
379-
nodes.update({
380-
id: node.id,
381-
fixed: false
382-
});
383-
});
373+
unfixNodes();
384374
postGraphState();
385375
});
386376
network.on('dragEnd', postGraphState);
@@ -413,4 +403,13 @@
413403
return nodePositions;
414404
}
415405

406+
function unfixNodes() {
407+
nodes.forEach(function (node) {
408+
nodes.update({
409+
id: node.id,
410+
fixed: false
411+
});
412+
});
413+
}
414+
416415
}());

0 commit comments

Comments
 (0)