Skip to content

Commit

Permalink
rename CanScaleSelectionOrigin/PlayfieldOrigin to make clear its not …
Browse files Browse the repository at this point in the history
…the origin being scaled
  • Loading branch information
OliBomby committed May 28, 2024
1 parent 36453f6 commit a89ba33
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Edit/OsuSelectionRotationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ protected override void LoadComplete()
private void updateState()
{
var quad = GeometryUtils.GetSurroundingQuad(selectedMovableObjects);
CanRotateSelectionOrigin.Value = quad.Width > 0 || quad.Height > 0;
CanRotatePlayfieldOrigin.Value = selectedMovableObjects.Any();
CanRotateFromSelectionOrigin.Value = quad.Width > 0 || quad.Height > 0;
CanRotateFromPlayfieldOrigin.Value = selectedMovableObjects.Any();
}

private OsuHitObject[]? objectsInRotation;
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Edit/OsuSelectionScaleHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ private void updateState()
CanScaleX.Value = quad.Width > 0;
CanScaleY.Value = quad.Height > 0;
CanScaleDiagonally.Value = CanScaleX.Value && CanScaleY.Value;
CanScaleSelectionOrigin.Value = CanScaleX.Value || CanScaleY.Value;
CanScalePlayfieldOrigin.Value = selectedMovableObjects.Any();
CanScaleFromSelectionOrigin.Value = CanScaleX.Value || CanScaleY.Value;
CanScaleFromPlayfieldOrigin.Value = selectedMovableObjects.Any();
}

private Dictionary<OsuHitObject, OriginalHitObjectState>? objectsInScale;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Edit/PreciseRotationPopover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected override void LoadComplete()
angleInput.Current.BindValueChanged(angle => rotationInfo.Value = rotationInfo.Value with { Degrees = angle.NewValue });
rotationOrigin.Items.First().Select();

rotationHandler.CanRotateSelectionOrigin.BindValueChanged(e =>
rotationHandler.CanRotateFromSelectionOrigin.BindValueChanged(e =>
{
selectionCentreButton.Selected.Disabled = !e.NewValue;
}, true);
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Edit/PreciseScalePopover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected override void LoadComplete()
xCheckBox.Current.BindValueChanged(x => setAxis(x.NewValue, yCheckBox.Current.Value));
yCheckBox.Current.BindValueChanged(y => setAxis(xCheckBox.Current.Value, y.NewValue));

scaleHandler.CanScaleSelectionOrigin.BindValueChanged(e =>
scaleHandler.CanScaleFromSelectionOrigin.BindValueChanged(e =>
{
selectionCentreButton.Selected.Disabled = !e.NewValue;
}, true);
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Osu/Edit/TransformToolboxGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ protected override void LoadComplete()
base.LoadComplete();

// aggregate two values into canRotate
canRotatePlayfieldOrigin = RotationHandler.CanRotatePlayfieldOrigin.GetBoundCopy();
canRotatePlayfieldOrigin = RotationHandler.CanRotateFromPlayfieldOrigin.GetBoundCopy();
canRotatePlayfieldOrigin.BindValueChanged(_ => updateCanRotateAggregate());

canRotateSelectionOrigin = RotationHandler.CanRotateSelectionOrigin.GetBoundCopy();
canRotateSelectionOrigin = RotationHandler.CanRotateFromSelectionOrigin.GetBoundCopy();
canRotateSelectionOrigin.BindValueChanged(_ => updateCanRotateAggregate());

void updateCanRotateAggregate()
{
canRotate.Value = RotationHandler.CanRotatePlayfieldOrigin.Value || RotationHandler.CanRotateSelectionOrigin.Value;
canRotate.Value = RotationHandler.CanRotateFromPlayfieldOrigin.Value || RotationHandler.CanRotateFromSelectionOrigin.Value;
}

// aggregate three values into canScale
Expand All @@ -82,12 +82,12 @@ void updateCanRotateAggregate()
canScaleY = ScaleHandler.CanScaleY.GetBoundCopy();
canScaleY.BindValueChanged(_ => updateCanScaleAggregate());

canScalePlayfieldOrigin = ScaleHandler.CanScalePlayfieldOrigin.GetBoundCopy();
canScalePlayfieldOrigin = ScaleHandler.CanScaleFromPlayfieldOrigin.GetBoundCopy();
canScalePlayfieldOrigin.BindValueChanged(_ => updateCanScaleAggregate());

void updateCanScaleAggregate()
{
canScale.Value = ScaleHandler.CanScaleX.Value || ScaleHandler.CanScaleY.Value || ScaleHandler.CanScalePlayfieldOrigin.Value;
canScale.Value = ScaleHandler.CanScaleX.Value || ScaleHandler.CanScaleY.Value || ScaleHandler.CanScaleFromPlayfieldOrigin.Value;
}

// bindings to `Enabled` on the buttons are decoupled on purpose
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tests/Visual/Editing/TestSceneComposeSelectBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public TestSelectionRotationHandler(Func<Container> getTargetContainer)
{
this.getTargetContainer = getTargetContainer;

CanRotateSelectionOrigin.Value = true;
CanRotateFromSelectionOrigin.Value = true;
}

[CanBeNull]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void LoadComplete()

private void updateState()
{
CanRotateSelectionOrigin.Value = selectedItems.Count > 0;
CanRotateFromSelectionOrigin.Value = selectedItems.Count > 0;
}

private Drawable[]? objectsInRotation;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public string Text
private void load()
{
if (rotationHandler != null)
canRotate.BindTo(rotationHandler.CanRotateSelectionOrigin);
canRotate.BindTo(rotationHandler.CanRotateFromSelectionOrigin);

if (scaleHandler != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public partial class SelectionRotationHandler : Component
/// <summary>
/// Whether rotation anchored by the selection origin can currently be performed.
/// </summary>
public Bindable<bool> CanRotateSelectionOrigin { get; private set; } = new BindableBool();
public Bindable<bool> CanRotateFromSelectionOrigin { get; private set; } = new BindableBool();

/// <summary>
/// Whether rotation anchored by the center of the playfield can currently be performed.
/// </summary>
public Bindable<bool> CanRotatePlayfieldOrigin { get; private set; } = new BindableBool();
public Bindable<bool> CanRotateFromPlayfieldOrigin { get; private set; } = new BindableBool();

/// <summary>
/// Performs a single, instant, atomic rotation operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public partial class SelectionScaleHandler : Component
/// <summary>
/// Whether scaling anchored by the selection origin can currently be performed.
/// </summary>
public Bindable<bool> CanScaleSelectionOrigin { get; private set; } = new BindableBool();
public Bindable<bool> CanScaleFromSelectionOrigin { get; private set; } = new BindableBool();

/// <summary>
/// Whether scaling anchored by the center of the playfield can currently be performed.
/// </summary>
public Bindable<bool> CanScalePlayfieldOrigin { get; private set; } = new BindableBool();
public Bindable<bool> CanScaleFromPlayfieldOrigin { get; private set; } = new BindableBool();

public Quad? OriginalSurroundingQuad { get; protected set; }

Expand Down

0 comments on commit a89ba33

Please sign in to comment.