Nodes Configuration
const element = document.getElementById('canvas'); const canvas = new CanvasBuilder() .setElement(element) .setDefaults({ nodes: { centerFn: (w, h) => ({ x: w / 2, y: h / 2 }), priority: "incremental", }, }) .build();
NodesConfig
Fields
Name | Type | Description | Required | Default |
---|---|---|---|---|
centerFn | function | Default function to determine the node’s center | no | (w, h) => ({ x: w / 2, y: h / 2 }) |
priority | Priority | Default node priority | no | 0 |
Priority
Options
Type | Description | Example |
---|---|---|
number | Each node is assigned a constant Z-index | 5 |
"incremental" | Each subsequent node receives an incremented Z-index | "incremental" |
function | Z-index is determined by a specified function | () => 10 + i++; |