-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep editor sidebars expanded by default
They will not only contract if the user chooses to have them contract (new setting in the `View` menu) or if the game isn't wide enough to allow full interaction with the playfield while they are expanded. Addressess ppy#28970.
- Loading branch information
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
// 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 osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Configuration; | ||
using osu.Game.Graphics.Containers; | ||
using osu.Game.Screens.Edit; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Edit | ||
|
@@ -12,13 +16,43 @@ public partial class ExpandingToolboxContainer : ExpandingContainer | |
{ | ||
protected override double HoverExpansionDelay => 250; | ||
|
||
protected override bool ExpandOnHover => expandOnHover; | ||
|
||
private readonly Bindable<bool> contractSidebars = new Bindable<bool>(); | ||
|
||
private bool expandOnHover; | ||
|
||
[Resolved] | ||
private Editor editor { get; set; } = null!; | ||
|
||
public ExpandingToolboxContainer(float contractedWidth, float expandedWidth) | ||
: base(contractedWidth, expandedWidth) | ||
{ | ||
RelativeSizeAxes = Axes.Y; | ||
|
||
FillFlow.Spacing = new Vector2(5); | ||
FillFlow.Padding = new MarginPadding { Vertical = 5 }; | ||
|
||
Expanded.Value = true; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuConfigManager config) | ||
{ | ||
config.BindWith(OsuSetting.EditorContractSidebars, contractSidebars); | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
|
||
bool requireContracting = contractSidebars.Value || editor.DrawSize.X / editor.DrawSize.Y < 1.7f; | ||
|
||
if (expandOnHover != requireContracting) | ||
{ | ||
expandOnHover = requireContracting; | ||
Expanded.Value = !expandOnHover; | ||
} | ||
} | ||
|
||
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => base.ReceivePositionalInputAtSubTree(screenSpacePos) && anyToolboxHovered(screenSpacePos); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters