mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:02:55 +08:00
Uninvert logic of SkinnableInfo.UsingClosestAnchor
Also rename "IsUsingClosestAnchor" to simply "UsingClosestAnchor".
This commit is contained in:
parent
63346f6b75
commit
da1c38d5a9
@ -60,7 +60,7 @@ namespace osu.Game.Extensions
|
|||||||
component.Scale = info.Scale;
|
component.Scale = info.Scale;
|
||||||
component.Anchor = info.Anchor;
|
component.Anchor = info.Anchor;
|
||||||
component.Origin = info.Origin;
|
component.Origin = info.Origin;
|
||||||
component.IsUsingClosestAnchor().Value = !info.IsNotUsingClosestAnchor;
|
component.UsingClosestAnchor().Value = info.UsingClosestAnchor;
|
||||||
|
|
||||||
if (component is Container container)
|
if (component is Container container)
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ namespace osu.Game.Extensions
|
|||||||
/// </summary>
|
/// </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,
|
/// <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>
|
/// 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));
|
is_drawable_using_closest_anchor_lookup.GetValue(drawable, _ => new BindableBool(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public Anchor Origin { get; set; }
|
public Anchor Origin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see langword="false"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is
|
/// <p><see langword="true"/> if this <see cref="ISkinnableDrawable"/>'s <see cref="Drawable.Anchor"/> is
|
||||||
/// automatically determined by proximity, <see langword="true"/> if the user has overridden it.
|
/// 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>
|
/// </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 UsingClosestAnchor { get; set; } = true;
|
||||||
public bool IsNotUsingClosestAnchor { get; set; }
|
|
||||||
|
|
||||||
public List<SkinnableInfo> Children { get; } = new List<SkinnableInfo>();
|
public List<SkinnableInfo> Children { get; } = new List<SkinnableInfo>();
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Scale = component.Scale;
|
Scale = component.Scale;
|
||||||
Anchor = component.Anchor;
|
Anchor = component.Anchor;
|
||||||
Origin = component.Origin;
|
Origin = component.Origin;
|
||||||
IsNotUsingClosestAnchor = !component.IsUsingClosestAnchor().Value;
|
UsingClosestAnchor = component.UsingClosestAnchor().Value;
|
||||||
|
|
||||||
if (component is Container<Drawable> container)
|
if (component is Container<Drawable> container)
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
private void updateDrawableAnchorIfUsingClosest(Drawable drawable)
|
private void updateDrawableAnchorIfUsingClosest(Drawable drawable)
|
||||||
{
|
{
|
||||||
if (!drawable.IsUsingClosestAnchor().Value) return;
|
if (!drawable.UsingClosestAnchor().Value) return;
|
||||||
|
|
||||||
var closestAnchor = getClosestAnchorForDrawable(drawable);
|
var closestAnchor = getClosestAnchorForDrawable(drawable);
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection)
|
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<ISkinnableDrawable>> selection)
|
||||||
{
|
{
|
||||||
int checkAnchor(Drawable drawable) =>
|
int checkAnchor(Drawable drawable) =>
|
||||||
drawable.IsUsingClosestAnchor().Value
|
drawable.UsingClosestAnchor().Value
|
||||||
? closest_text_hash
|
? closest_text_hash
|
||||||
: (int)drawable.Anchor;
|
: (int)drawable.Anchor;
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
private Anchor getAnchorFromHashAndDrawableAndRecordWhetherUsingClosestAnchor(int hash, Drawable drawable)
|
private Anchor getAnchorFromHashAndDrawableAndRecordWhetherUsingClosestAnchor(int hash, Drawable drawable)
|
||||||
{
|
{
|
||||||
var isUsingClosestAnchor = drawable.IsUsingClosestAnchor();
|
var isUsingClosestAnchor = drawable.UsingClosestAnchor();
|
||||||
|
|
||||||
if (hash == closest_text_hash)
|
if (hash == closest_text_hash)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user