Files
sbox-public/engine/Sandbox.Engine/Systems/UI/Panel/Event/DragEvent.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

43 lines
1.0 KiB
C#

namespace Sandbox.UI;
public class DragEvent : PanelEvent
{
/// <summary>
/// For ondrag event - the delta of the mouse movement
/// </summary>
public Vector2 MouseDelta;
/// <summary>
/// The position on the Target panel where the drag started
/// </summary>
public Vector2 LocalGrabPosition;
/// <summary>
/// The position relative to the screen where the drag started
/// </summary>
public Vector2 ScreenGrabPosition;
/// <summary>
/// The current mouse position relative to target
/// </summary>
public Vector2 LocalPosition;
/// <summary>
/// The current position relative to the screen
/// </summary>
public Vector2 ScreenPosition;
internal DragEvent( string event_name, Panel active, Vector2 localDragStart, Vector2 globalDragStart ) : base( event_name, active )
{
Name = event_name;
Target = active;
LocalGrabPosition = localDragStart;
ScreenGrabPosition = globalDragStart;
LocalPosition = Target.MousePosition + Target.ScrollOffset;
ScreenPosition = Mouse.Position;
}
}