How to Change Color When Dragging Another Node in the Angular Diagram?
In this article, you can learn how to change the color when dragging another node in the Angular Diagram. Syncfusion® Angular Diagram provides the ability to customize the style of the highlighter. You can modify the stroke color of the highlighter when dragging and dropping a node over another element by using the .e-diagram-highlighter class.
Enabling Highlighter for a Node
To enable the highlighter for a node, you need to set the allowDrop constraints for that specific node. This can be achieved by modifying the node’s constraints as shown in the following example:
public nodes: NodeModel[] = [
{
id: 'node1',
offsetX: 300, offsetY: 300,
height: 100, width: 100,
constraints: NodeConstraints.Default | NodeConstraints.AllowDrop
}
]
Customizing the Highlighter Style
The highlighter’s style can be customized using CSS. For instance, to change the stroke color of the highlighter, you need define the style for the .e-diagram-highlighter class as follows:
<style>
.e-diagram-highlighter {
stroke: blue;
}
</style>
You can find a working example of this implementation on StackBlitz in the provided link: Click here for sample
Conclusion:
We hope you enjoyed learning about how to change color when dragging another node in the Angular Diagram.
You can refer to our Angular Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!