From 55f425320e7b921c2056affbc104a4f0063a6b91 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 17 Oct 2024 12:25:38 +0200 Subject: [PATCH] add 2 new cytoscape layouts --- app/class/Modelhome.php | 2 ++ package.json | 2 ++ src/graph.js | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/class/Modelhome.php b/app/class/Modelhome.php index 506e975b..faee6d1f 100644 --- a/app/class/Modelhome.php +++ b/app/class/Modelhome.php @@ -6,7 +6,9 @@ class Modelhome extends Model { public const GRAPH_LAYOUTS = [ 'cose' => 'cose', + 'fcose' => 'fcose', 'cose-bilkent' => 'cose-bilkent', + 'euler' => 'euler', 'circle' => 'circle', 'breadthfirst' => 'breadthfirst', 'concentric' => 'concentric', diff --git a/package.json b/package.json index cf74e7dd..7964c020 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "codemirror": "^5.63.3", "cytoscape": "^3.20.0", "cytoscape-cose-bilkent": "^4.1.0", + "cytoscape-euler": "^1.2.3", + "cytoscape-fcose": "^2.2.0", "leaflet": "^1.9.3" }, "devDependencies": { diff --git a/src/graph.js b/src/graph.js index 4723318e..1650e632 100644 --- a/src/graph.js +++ b/src/graph.js @@ -1,6 +1,10 @@ import cytoscape from 'cytoscape'; import coseBilkent from 'cytoscape-cose-bilkent'; +import fcose from 'cytoscape-fcose'; +import euler from 'cytoscape-euler'; +cytoscape.use(euler); +cytoscape.use(fcose); cytoscape.use(coseBilkent); let options = { @@ -14,10 +18,10 @@ let cy = cytoscape(options); cy.on('tap', 'node', function() { try { // your browser may block popups - window.open(this.data('id')); + window.open(this.data('leftclick')); } catch (e) { // fall back on url change - window.location.href = this.data('id'); + window.location.href = this.data('leftclick'); } });