From da1c38d5a907ae2e4122b4d133f38a60949d0435 Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Sun, 6 Jun 2021 10:10:55 -0400 Subject: [PATCH] Uninvert logic of SkinnableInfo.UsingClosestAnchor Also rename "IsUsingClosestAnchor" to simply "UsingClosestAnchor". --- osu.Game/Extensions/DrawableExtensions.cs | 4 ++-- osu.Game/Screens/Play/HUD/SkinnableInfo.cs | 10 +++++----- osu.Game/Skinning/Editor/SkinSelectionHandler.cs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Extensions/DrawableExtensions.cs b/osu.Game/Extensions/DrawableExtensions.cs index d8c627ea8e..f66fe2b8b2 100644 --- a/osu.Game/Extensions/DrawableExtensions.cs +++ b/osu.Game/Extensions/DrawableExtensions.cs @@ -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 /// /// A whose is if the is using the closest anchor point, /// otherwise . - 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)); } } diff --git a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs index 3e829f6d38..8ca5f1ba2d 100644 --- a/osu.Game/Screens/Play/HUD/SkinnableInfo.cs +++ b/osu.Game/Screens/Play/HUD/SkinnableInfo.cs @@ -33,11 +33,11 @@ namespace osu.Game.Screens.Play.HUD public Anchor Origin { get; set; } /// - /// if this 's is - /// automatically determined by proximity, if the user has overridden it. + ///

if this 's is + /// automatically determined by proximity, if the user has overridden it.

+ ///

Corresponds to at runtime.

///
- /// Stored this way because default(bool) is and we want the default behaviour to be "closest". - public bool IsNotUsingClosestAnchor { get; set; } + public bool UsingClosestAnchor { get; set; } = true; public List Children { get; } = new List(); @@ -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 container) { diff --git a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs index b1d353b0af..f8d41d94fa 100644 --- a/osu.Game/Skinning/Editor/SkinSelectionHandler.cs +++ b/osu.Game/Skinning/Editor/SkinSelectionHandler.cs @@ -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 GetContextMenuItemsForSelection(IEnumerable> 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) {