Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
using osu.Game.Overlays.OSD;
using osu.Game.Overlays.SkinEditor;
using osu.Game.Overlays.Toolbar;
using osu.Game.Overlays.Volume;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
Expand Down Expand Up @@ -1207,6 +1208,7 @@ protected override void LoadComplete()
}, topMostOverlayContent.Add);

loadComponentSingleFile(volume = new VolumeOverlay(), leftFloatingOverlayContent.Add, true);
topMostOverlayContent.Add(new GlobalAltScrollAdjustsVolume());

onScreenDisplay = new OnScreenDisplay();

Expand Down
27 changes: 27 additions & 0 deletions osu.Game/Overlays/Volume/GlobalAltScrollAdjustsVolume.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Framework.Input.Events;

namespace osu.Game.Overlays.Volume
{
/// <summary>
/// Allows adjusting volume via mouse scroll while holding alt, regardless of the current game state.
/// </summary>
public partial class GlobalAltScrollAdjustsVolume : GlobalScrollAdjustsVolume
{
protected override bool OnScroll(ScrollEvent e)
{
if (!e.AltPressed || e.ControlPressed || e.ShiftPressed)
return false;

var hoveredDrawables = GetContainingInputManager()?.HoveredDrawables;
if (hoveredDrawables?.Any(d => d is ZoomableScrollContainer) == true)
return false;

return base.OnScroll(e);
}
}
}
Loading