mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Fix dialog dangerous button being clickable at edges
This commit is contained in:
@ -12,37 +12,38 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
{
|
{
|
||||||
public class PopupDialogDangerousButton : PopupDialogButton
|
public class PopupDialogDangerousButton : PopupDialogButton
|
||||||
{
|
{
|
||||||
|
private Box progressBox;
|
||||||
|
private DangerousConfirmContainer confirmContainer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Red3;
|
ButtonColour = colours.Red3;
|
||||||
|
|
||||||
ColourContainer.Add(new ConfirmFillBox
|
ColourContainer.Add(progressBox = new Box
|
||||||
{
|
{
|
||||||
Action = () => Action(),
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Blending = BlendingParameters.Additive,
|
Blending = BlendingParameters.Additive,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
private class ConfirmFillBox : HoldToConfirmContainer
|
AddInternal(confirmContainer = new DangerousConfirmContainer
|
||||||
{
|
{
|
||||||
private Box box;
|
Action = () => Action(),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
protected override double? HoldActivationDelay => 500;
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Child = box = new Box
|
confirmContainer.Progress.BindValueChanged(progress => progressBox.Width = (float)progress.NewValue, true);
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
};
|
|
||||||
|
|
||||||
Progress.BindValueChanged(progress => box.Width = (float)progress.NewValue, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DangerousConfirmContainer : HoldToConfirmContainer
|
||||||
|
{
|
||||||
|
protected override double? HoldActivationDelay => 500;
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
BeginConfirm();
|
BeginConfirm();
|
||||||
|
Reference in New Issue
Block a user