Description
The DragDirection
enumeration in the Editor.NodeEditor
namespace defines the possible directions in which a node can be dragged within the node editor interface. This enum is used to specify whether the dragging action should be constrained to a horizontal or vertical direction.
Usage
Use the DragDirection
enum to specify the direction of drag operations in the node editor. This can be useful when implementing custom node editor behaviors or when you need to restrict node movement to a specific axis.
For example, if you want to allow nodes to be dragged only horizontally, you would use DragDirection.Horizontal
. Conversely, for vertical dragging, use DragDirection.Vertical
.
Example
// Example of using DragDirection in a node editor context
public class CustomNodeEditor : NodeEditor
{
public void OnNodeDrag(Node node, DragDirection direction)
{
if (direction == DragDirection.Horizontal)
{
// Handle horizontal dragging logic
}
else if (direction == DragDirection.Vertical)
{
// Handle vertical dragging logic
}
}
}