Skip to content

Commit e96682e

Browse files
committed
If no nodes has a position/bounds defined then the layout of the graph is changed to 'cose'
1 parent d956846 commit e96682e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

templates/dgmlViewer_Template.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,15 @@
338338
});
339339

340340
layoutDiv.style['display'] = showLayoutOptionsCheckbox.checked ? 'block' : 'none';
341-
341+
let hasPositions = false;
342+
nodeElements.forEach(node => {
343+
if(node.position) {
344+
hasPositions = true;
345+
}
346+
});
347+
if (!hasPositions) {
348+
layoutSelect.value = 'cose';
349+
}
342350
let options = {
343351
name: layoutSelect.value ? layoutSelect.value : defaultLayout
344352
};

0 commit comments

Comments
 (0)