mirror of
https://github.com/ppy/osu.git
synced 2025-03-11 15:27:20 +08:00
Merge pull request #30219 from bdach/scale-with-no-axes-should-do-nothing
Ensure at least one scale popover axis is active at any time
This commit is contained in:
commit
8e76dd553e
@ -136,8 +136,26 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
});
|
||||
scaleInput.Current.BindValueChanged(scale => scaleInfo.Value = scaleInfo.Value with { Scale = scale.NewValue });
|
||||
|
||||
xCheckBox.Current.BindValueChanged(x => setAxis(x.NewValue, yCheckBox.Current.Value));
|
||||
yCheckBox.Current.BindValueChanged(y => setAxis(xCheckBox.Current.Value, y.NewValue));
|
||||
xCheckBox.Current.BindValueChanged(_ =>
|
||||
{
|
||||
if (!xCheckBox.Current.Value && !yCheckBox.Current.Value)
|
||||
{
|
||||
yCheckBox.Current.Value = true;
|
||||
return;
|
||||
}
|
||||
|
||||
updateAxes();
|
||||
});
|
||||
yCheckBox.Current.BindValueChanged(_ =>
|
||||
{
|
||||
if (!xCheckBox.Current.Value && !yCheckBox.Current.Value)
|
||||
{
|
||||
xCheckBox.Current.Value = true;
|
||||
return;
|
||||
}
|
||||
|
||||
updateAxes();
|
||||
});
|
||||
|
||||
selectionCentreButton.Selected.Disabled = !(scaleHandler.CanScaleX.Value || scaleHandler.CanScaleY.Value);
|
||||
playfieldCentreButton.Selected.Disabled = scaleHandler.IsScalingSlider.Value && !selectionCentreButton.Selected.Disabled;
|
||||
@ -152,6 +170,12 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAxes()
|
||||
{
|
||||
scaleInfo.Value = scaleInfo.Value with { XAxis = xCheckBox.Current.Value, YAxis = yCheckBox.Current.Value };
|
||||
updateMinMaxScale();
|
||||
}
|
||||
|
||||
private void updateAxisCheckBoxesEnabled()
|
||||
{
|
||||
if (scaleInfo.Value.Origin != ScaleOrigin.SelectionCentre)
|
||||
@ -230,16 +254,21 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
}
|
||||
}
|
||||
|
||||
private Axes getAdjustAxis(PreciseScaleInfo scale) => scale.XAxis ? scale.YAxis ? Axes.Both : Axes.X : Axes.Y;
|
||||
private Axes getAdjustAxis(PreciseScaleInfo scale)
|
||||
{
|
||||
var result = Axes.None;
|
||||
|
||||
if (scale.XAxis)
|
||||
result |= Axes.X;
|
||||
|
||||
if (scale.YAxis)
|
||||
result |= Axes.Y;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private float getRotation(PreciseScaleInfo scale) => scale.Origin == ScaleOrigin.GridCentre ? gridToolbox.GridLinesRotation.Value : 0;
|
||||
|
||||
private void setAxis(bool x, bool y)
|
||||
{
|
||||
scaleInfo.Value = scaleInfo.Value with { XAxis = x, YAxis = y };
|
||||
updateMinMaxScale();
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
Loading…
x
Reference in New Issue
Block a user