mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge remote-tracking branch 'upstream/master' into re-order-events
This commit is contained in:
@ -27,11 +27,12 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
||||
|
||||
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
||||
private void scrollFromMouseEvent(MouseEvent e) =>
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
private bool mouseScrollBarDragging;
|
||||
private bool rightMouseDragging;
|
||||
|
||||
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
||||
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
||||
|
||||
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
||||
: base(scrollDirection)
|
||||
@ -42,7 +43,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(e))
|
||||
{
|
||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
||||
scrollFromMouseEvent(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,9 +52,9 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
if (rightMouseDragging)
|
||||
{
|
||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
||||
scrollFromMouseEvent(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(e))
|
||||
{
|
||||
mouseScrollBarDragging = true;
|
||||
rightMouseDragging = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,9 +74,9 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
if (rightMouseDragging)
|
||||
{
|
||||
mouseScrollBarDragging = false;
|
||||
rightMouseDragging = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,8 @@ namespace osu.Game.Graphics
|
||||
|
||||
using (var image = await host.TakeScreenshotAsync())
|
||||
{
|
||||
Interlocked.Decrement(ref screenShotTasks);
|
||||
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
|
||||
cursorVisibility.Value = true;
|
||||
|
||||
var fileName = getFileName();
|
||||
if (fileName == null) return;
|
||||
@ -125,14 +126,6 @@ namespace osu.Game.Graphics
|
||||
}
|
||||
});
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (cursorVisibility.Value == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0)
|
||||
cursorVisibility.Value = true;
|
||||
}
|
||||
|
||||
private string getFileName()
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
|
44
osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
Normal file
44
osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class DimmedLoadingLayer : VisibilityContainer
|
||||
{
|
||||
private const float transition_duration = 250;
|
||||
|
||||
private readonly LoadingAnimation loading;
|
||||
|
||||
public DimmedLoadingLayer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
loading = new LoadingAnimation(),
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
this.FadeIn(transition_duration, Easing.OutQuint);
|
||||
loading.Show();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
this.FadeOut(transition_duration, Easing.OutQuint);
|
||||
loading.Hide();
|
||||
}
|
||||
}
|
||||
}
|
@ -76,7 +76,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Masking = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathRadius = 1 }
|
||||
Child = path = new SmoothPath
|
||||
{
|
||||
AutoSizeAxes = Axes.None,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
PathRadius = 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText { Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) },
|
||||
text = new OsuSpriteText { Font = OsuFont.GetFont(size: 14) },
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Size = new Vector2(14),
|
||||
@ -81,10 +81,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Colour = Color4.White,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
}
|
||||
},
|
||||
new HoverClickSounds()
|
||||
};
|
||||
|
||||
Current.ValueChanged += selected => { icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle; };
|
||||
Current.ValueChanged += selected =>
|
||||
{
|
||||
icon.Icon = selected.NewValue ? FontAwesome.Regular.CheckCircle : FontAwesome.Regular.Circle;
|
||||
text.Font = text.Font.With(weight: selected.NewValue ? FontWeight.Bold : FontWeight.Medium);
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
Reference in New Issue
Block a user