1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

remove redundant CanScaleFromSelectionOrigin

This commit is contained in:
OliBomby 2024-05-28 16:19:57 +02:00
parent a89ba33b47
commit 8eb23f8a60
3 changed files with 12 additions and 10 deletions

View File

@ -53,7 +53,6 @@ namespace osu.Game.Rulesets.Osu.Edit
CanScaleX.Value = quad.Width > 0;
CanScaleY.Value = quad.Height > 0;
CanScaleDiagonally.Value = CanScaleX.Value && CanScaleY.Value;
CanScaleFromSelectionOrigin.Value = CanScaleX.Value || CanScaleY.Value;
CanScaleFromPlayfieldOrigin.Value = selectedMovableObjects.Any();
}

View File

@ -32,6 +32,9 @@ namespace osu.Game.Rulesets.Osu.Edit
private OsuCheckbox xCheckBox = null!;
private OsuCheckbox yCheckBox = null!;
private Bindable<bool> canScaleX = null!;
private Bindable<bool> canScaleY = null!;
public PreciseScalePopover(SelectionScaleHandler scaleHandler)
{
this.scaleHandler = scaleHandler;
@ -118,10 +121,15 @@ namespace osu.Game.Rulesets.Osu.Edit
xCheckBox.Current.BindValueChanged(x => setAxis(x.NewValue, yCheckBox.Current.Value));
yCheckBox.Current.BindValueChanged(y => setAxis(xCheckBox.Current.Value, y.NewValue));
scaleHandler.CanScaleFromSelectionOrigin.BindValueChanged(e =>
{
selectionCentreButton.Selected.Disabled = !e.NewValue;
}, true);
// aggregate two values into canScaleFromSelectionCentre
canScaleX = scaleHandler.CanScaleX.GetBoundCopy();
canScaleX.BindValueChanged(_ => updateCanScaleFromSelectionCentre());
canScaleY = scaleHandler.CanScaleY.GetBoundCopy();
canScaleY.BindValueChanged(_ => updateCanScaleFromSelectionCentre(), true);
void updateCanScaleFromSelectionCentre() =>
selectionCentreButton.Selected.Disabled = !(scaleHandler.CanScaleY.Value || scaleHandler.CanScaleFromPlayfieldOrigin.Value);
scaleInfo.BindValueChanged(scale =>
{

View File

@ -32,11 +32,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </remarks>
public Bindable<bool> CanScaleDiagonally { get; private set; } = new BindableBool();
/// <summary>
/// Whether scaling anchored by the selection origin can currently be performed.
/// </summary>
public Bindable<bool> CanScaleFromSelectionOrigin { get; private set; } = new BindableBool();
/// <summary>
/// Whether scaling anchored by the center of the playfield can currently be performed.
/// </summary>