NgDiagramNodeService
The NgDiagramNodeService
provides methods for manipulating nodes in the diagram.
Example usage
Section titled “Example usage”private nodeService = inject(NgDiagramNodeService);
// Move nodes by a deltathis.nodeService.moveNodesBy([node1, node2], { x: 10, y: 20 });
Extends
Section titled “Extends”NgDiagramBaseService
Methods
Section titled “Methods”bringToFront()
Section titled “bringToFront()”bringToFront(
nodeIds?
,edgeIds?
):void
Brings the specified nodes and edges to the front (highest z-index).
Parameters
Section titled “Parameters”nodeIds?
Section titled “nodeIds?”string
[]
Array of node IDs to bring to front.
edgeIds?
Section titled “edgeIds?”string
[]
Array of edge IDs to bring to front.
Returns
Section titled “Returns”void
moveNodesBy()
Section titled “moveNodesBy()”moveNodesBy(
nodes
,delta
):void
Moves nodes by the specified amounts.
Parameters
Section titled “Parameters”Node
[]
Array of nodes to move.
The amount to move the nodes by.
Returns
Section titled “Returns”void
resizeNode()
Section titled “resizeNode()”resizeNode(
id
,size
,position?
,disableAutoSize?
):void
Resizes a node to the specified dimensions.
Parameters
Section titled “Parameters”string
The ID of the node to resize.
The new size of the node.
position?
Section titled “position?”Optional new position of the node.
disableAutoSize?
Section titled “disableAutoSize?”boolean
Optional flag to disable auto-sizing.
Returns
Section titled “Returns”void
rotateNodeTo()
Section titled “rotateNodeTo()”rotateNodeTo(
nodeId
,angle
):void
Rotates a node to the specified angle.
Parameters
Section titled “Parameters”nodeId
Section titled “nodeId”string
The ID of the node to rotate.
number
The rotation angle in degrees.
Returns
Section titled “Returns”void
sendToBack()
Section titled “sendToBack()”sendToBack(
nodeIds?
,edgeIds?
):void
Sends the specified nodes and edges to the back (lowest z-index).
Parameters
Section titled “Parameters”nodeIds?
Section titled “nodeIds?”string
[]
Array of node IDs to send to back.
edgeIds?
Section titled “edgeIds?”string
[]
Array of edge IDs to send to back.
Returns
Section titled “Returns”void