From ee24f3a101b303be032d60eee3f81fd71eab828a Mon Sep 17 00:00:00 2001 From: Rafael Matias Date: Wed, 7 Aug 2024 13:17:11 +0200 Subject: [PATCH] disable physics animations by stabilizing the network when there are more than 20 nodes due to performance issues --- templates/clients/clients_cl.html | 6 ++++++ templates/clients/clients_el.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/templates/clients/clients_cl.html b/templates/clients/clients_cl.html index 66d8cec..f1e42cf 100644 --- a/templates/clients/clients_cl.html +++ b/templates/clients/clients_cl.html @@ -180,6 +180,12 @@

data.nodes[i].title = data.nodes[i].id; } var options = $_network.defaultOptions; + + // Performance improvements. Less animations + if (data.nodes.length >= 20) { + options.physics.stabilization = true + } + var network = new vis.Network(container, data, options); sleep(1000).then(() => { diff --git a/templates/clients/clients_el.html b/templates/clients/clients_el.html index c58ab60..daeb06c 100644 --- a/templates/clients/clients_el.html +++ b/templates/clients/clients_el.html @@ -210,6 +210,12 @@

data.nodes[i].title = data.nodes[i].id; } var options = $_network.defaultOptions; + + // Performance improvements. Less animations + if (data.nodes.length >= 20) { + options.physics.stabilization = true + } + var network = new vis.Network(container, data, options); sleep(1000).then(() => {