UX improvements to Air Alarm UI (#12681)

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
eoineoineoin
2022-12-06 23:46:07 +00:00
committed by GitHub
parent dadd34286e
commit ff9cf108b6
16 changed files with 649 additions and 495 deletions

View File

@@ -8,6 +8,8 @@ namespace Content.Client.UserInterface.Controls
[Virtual]
public partial class FancyWindow : BaseWindow
{
private const int DRAG_MARGIN_SIZE = 7;
public FancyWindow()
{
RobustXamlLoader.Load(this);
@@ -24,7 +26,30 @@ namespace Content.Client.UserInterface.Controls
protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
{
return DragMode.Move;
var mode = DragMode.Move;
if (Resizable)
{
if (relativeMousePos.Y < DRAG_MARGIN_SIZE)
{
mode = DragMode.Top;
}
else if (relativeMousePos.Y > Size.Y - DRAG_MARGIN_SIZE)
{
mode = DragMode.Bottom;
}
if (relativeMousePos.X < DRAG_MARGIN_SIZE)
{
mode |= DragMode.Left;
}
else if (relativeMousePos.X > Size.X - DRAG_MARGIN_SIZE)
{
mode |= DragMode.Right;
}
}
return mode;
}
}
}