Description
The CursorDragDelta
property provides the delta of cursor movement between the last mouse press and the current position, measured in screen space. This property is useful for tracking how much the cursor has moved while the left mouse button is held down. If the left mouse button is not currently pressed, this property will return the value of CursorMoveDelta
, which represents the cursor movement between the current and previous frames.
Usage
Use CursorDragDelta
to determine the amount of movement the cursor has made while dragging. This can be particularly useful in scenarios where you need to implement drag-and-drop functionality or track user interactions with a graphical interface.
Example
// Example usage of CursorDragDelta
Vector2 dragDelta = Gizmo.CursorDragDelta;
if (Gizmo.IsLeftMouseDown)
{
// Perform actions based on the drag delta
// For example, moving an object in the scene
MoveObject(dragDelta);
}
else
{
// Handle other cursor movements
Vector2 moveDelta = Gizmo.CursorMoveDelta;
// Perform actions based on the move delta
}