mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 13:59:22 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
namespace Editor;
|
|
|
|
public partial class SoundPlayer
|
|
{
|
|
public class Scrubber : GraphicsItem
|
|
{
|
|
private readonly TimelineView TimelineView;
|
|
|
|
public Scrubber( TimelineView view )
|
|
{
|
|
TimelineView = view;
|
|
ZIndex = -1;
|
|
HoverEvents = true;
|
|
Cursor = CursorShape.SizeH;
|
|
Movable = true;
|
|
Selectable = true;
|
|
}
|
|
|
|
protected override void OnPaint()
|
|
{
|
|
base.OnPaint();
|
|
|
|
Paint.Antialiasing = false;
|
|
Paint.ClearPen();
|
|
Paint.SetBrush( Theme.Green.WithAlpha( 0.7f ) );
|
|
|
|
var boxRect = new Rect( new Vector2( 0, (Theme.RowHeight / 2) + 1 ), new Vector2( LocalRect.Width, Theme.RowHeight / 2 ) );
|
|
Paint.DrawPolygon( boxRect.TopLeft, boxRect.TopRight, boxRect.BottomRight - new Vector2( 0, 4 ), boxRect.Center.WithY( boxRect.Bottom ), boxRect.BottomLeft - new Vector2( 0, 4 ) );
|
|
|
|
Paint.SetPen( Theme.Green.WithAlpha( 0.7f ) );
|
|
Paint.DrawLine( new Vector2( 4, Theme.RowHeight + 1 ), new Vector2( 4, LocalRect.Bottom ) );
|
|
|
|
}
|
|
|
|
protected override void OnMousePressed( GraphicsMouseEvent e )
|
|
{
|
|
base.OnMousePressed( e );
|
|
TimelineView.Scrubbing = true;
|
|
}
|
|
|
|
protected override void OnMouseReleased( GraphicsMouseEvent e )
|
|
{
|
|
base.OnMouseReleased( e );
|
|
TimelineView.Scrubbing = false;
|
|
}
|
|
|
|
protected override void OnMoved()
|
|
{
|
|
base.OnMoved();
|
|
|
|
TimelineView.Scrubbing = true;
|
|
TimelineView.MoveScrubber( Position.x, false );
|
|
}
|
|
}
|
|
|
|
}
|