1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Uninvert logic of SkinnableInfo.UsingClosestAnchor

Also rename "IsUsingClosestAnchor" to simply "UsingClosestAnchor".
This commit is contained in:
Robin Avery 2021-06-06 10:10:55 -04:00
parent 63346f6b75
commit da1c38d5a9
No known key found for this signature in database
GPG Key ID: 0496DF10CEF7E226
3 changed files with 10 additions and 10 deletions

View File

@ -60,7 +60,7 @@ namespace osu.Game.Extensions
component.Scale = info.Scale;
component.Anchor = info.Anchor;
component.Origin = info.Origin;
component.IsUsingClosestAnchor().Value = !info.IsNotUsingClosestAnchor;
component.UsingClosestAnchor().Value = info.UsingClosestAnchor;
if (component is Container container)
{
@ -87,7 +87,7 @@ namespace osu.Game.Extensions
/// </summary>
/// <returns>A <see cref="BindableBool"/> whose <see cref="Bindable{T}.Value"/> is <see langword="true"/> if the <see cref="IDrawable"/> is using the closest anchor point,
/// otherwise <see langword="false"/>.</returns>
public static BindableBool IsUsingClosestAnchor(this IDrawable drawable) =>
public static BindableBool UsingClosestAnchor(this IDrawable drawable) =>
is_drawable_using_closest_anchor_lookup.GetValue(drawable, _ => new BindableBool(true));
}
}

View File

@ -33,11 +33,11 @@ namespace osu.Game.Screens.Play.HUD
public Anchor Origin { get; set; }
/// <summary>
/// <see langword="false"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is
/// automatically determined by proximity, <see langword="true"/> if the user has overridden it.
/// <p><see langword="true"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is
/// automatically determined by proximity, <see langword="false"/> if the user has overridden it.</p>
/// <p>Corresponds to <see cref="osu.Game.Extensions.DrawableExtensions.UsingClosestAnchor"/> at runtime.</p>
/// </summary>
/// <remarks>Stored this way because <c>default(bool)</c> is <see langword="false"/> and we want the default behaviour to be "closest".</remarks>
public bool IsNotUsingClosestAnchor { get; set; }
public bool UsingClosestAnchor { get; set; } = true;
public List<SkinnableInfo> Children { get; } = new List<SkinnableInfo>();
@ -59,7 +59,7 @@ namespace osu.Game.Screens.Play.HUD
Scale = component.Scale;
Anchor = component.Anchor;
Origin = component.Origin;
IsNotUsingClosestAnchor = !component.IsUsingClosestAnchor().Value;
UsingClosestAnchor = component.UsingClosestAnchor().Value;
if (component is Container<Drawable> container)
{

View File

@ -243,7 +243,7 @@ namespace osu.Game.Skinning.Editor
private void updateDrawableAnchorIfUsingClosest(Drawable drawable)
{
if (!drawable.IsUsingClosestAnchor().Value) return;
if (!drawable.UsingClosestAnchor().Value) return;
var closestAnchor = getClosestAnchorForDrawable(drawable);
@ -268,7 +268,7 @@ namespace osu.Game.Skinning.Editor
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection)
{
int checkAnchor(Drawable drawable) =>
drawable.IsUsingClosestAnchor().Value
drawable.UsingClosestAnchor().Value
? closest_text_hash
: (int)drawable.Anchor;
@ -348,7 +348,7 @@ namespace osu.Game.Skinning.Editor
private Anchor getAnchorFromHashAndDrawableAndRecordWhetherUsingClosestAnchor(int hash, Drawable drawable)
{
var isUsingClosestAnchor = drawable.IsUsingClosestAnchor();
var isUsingClosestAnchor = drawable.UsingClosestAnchor();
if (hash == closest_text_hash)
{