Merge pull request #10943 from peppy/editor-setup-scroll-to-file-selector

Scroll editor setup screen to file selector on display
This commit is contained in:
Dan Balasescu
2020-11-24 16:26:25 +09:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@ -3,10 +3,12 @@
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
@ -21,6 +23,9 @@ namespace osu.Game.Screens.Edit.Setup
private readonly IBindable<FileInfo> currentFile = new Bindable<FileInfo>();
[Resolved]
private SectionsContainer<SetupSection> sectionsContainer { get; set; }
public FileChooserLabelledTextBox()
{
currentFile.BindValueChanged(onFileSelected);
@ -47,14 +52,16 @@ namespace osu.Game.Screens.Edit.Setup
public void DisplayFileChooser()
{
Target.Child = new FileSelector(validFileExtensions: ResourcesSection.AudioExtensions)
FileSelector fileSelector;
Target.Child = fileSelector = new FileSelector(validFileExtensions: ResourcesSection.AudioExtensions)
{
RelativeSizeAxes = Axes.X,
Height = 400,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
CurrentFile = { BindTarget = currentFile }
};
sectionsContainer.ScrollTo(fileSelector);
}
internal class FileChooserOsuTextBox : OsuTextBox