1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 17:27:24 +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; CanScaleX.Value = quad.Width > 0;
CanScaleY.Value = quad.Height > 0; CanScaleY.Value = quad.Height > 0;
CanScaleDiagonally.Value = CanScaleX.Value && CanScaleY.Value; CanScaleDiagonally.Value = CanScaleX.Value && CanScaleY.Value;
CanScaleFromSelectionOrigin.Value = CanScaleX.Value || CanScaleY.Value;
CanScaleFromPlayfieldOrigin.Value = selectedMovableObjects.Any(); CanScaleFromPlayfieldOrigin.Value = selectedMovableObjects.Any();
} }

View File

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

View File

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