When creating a renderer, you can control how VivaGraph handles user input (zooming, node dragging, and background dragging) using the interactive option. By default, all interactions are enabled.
To disable all interactions entirely, pass false to the interactive option.
To enable specific features while disabling others, pass a string containing one or more of the following keywords:
node: enables dragging individual nodes with the left mouse.drag: enables dragging the entire graph by dragging the background canvas.scroll: enables zooming in/out using the scroll event.
Note: If you provide a string with specific keywords, any feature not mentioned in the string will be disabled.
// Disable all interactions
Viva.Graph.View.renderer(graph, {
interactive: false
});
// Enable only node dragging (disables scroll and background drag)
Viva.Graph.View.renderer(graph, {
interactive: 'node'
});
// Enable node dragging and background dragging (disables scroll)
Viva.Graph.View.renderer(graph, {
interactive: 'node drag'
});
// Enable only scroll-zoom
Viva.Graph.View.renderer(graph, {
interactive: 'scroll'
});
// Enable all interactions explicitly
Viva.Graph.View.renderer(graph, {
interactive: 'scroll drag node'
});