Layout is recalculated when the graph topology changes. Calculation occurs in the next microtask, allowing intensive layout computations to run after all nodes and edges have been added.
"topologyChangeMicrotask"
TopologyChangeMacrotask
Layout is recalculated when the graph topology changes. Calculation occurs in the next macrotask, allowing intensive layout computations to run after all nodes and edges have been added.
"topologyChangeMacrotask"
Manual
Layout is recalculated when the emit method is called on the provided EventSubject instance, as shown in the example below.
new EventSubject()
Manual Layout Trigger
import { CanvasBuilder, EventSubject } from "@html-graph/html-graph";
const element = document.getElementById("canvas");
const trigger = new EventSubject();
const canvas = new CanvasBuilder(element)
.enableLayout({
applyOn: trigger,
})
.build();
// Add all nodes and edges here
// Then trigger the layout calculation
trigger.emit();