mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-15 17:59:22 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
43 lines
1.0 KiB
C#
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;
|
|
|
|
}
|
|
}
|