Remove ScaleDownToFit as it was not implemented without enough safety

This commit is contained in:
Dean Herbert 2020-03-31 13:45:55 +09:00
parent e0a876ceaf
commit 1fce7cce01
3 changed files with 7 additions and 15 deletions

View File

@ -16,7 +16,7 @@ public class CatcherSprite : SkinnableDrawable
public CatcherSprite(CatcherAnimationState state)
: base(new CatchSkinComponent(componentFromState(state)), _ =>
new DefaultCatcherSprite(state), confineMode: ConfineMode.ScaleDownToFit)
new DefaultCatcherSprite(state), confineMode: ConfineMode.ScaleToFit)
{
RelativeSizeAxes = Axes.None;
Size = new Vector2(CatcherArea.CATCHER_SIZE);

View File

@ -182,7 +182,7 @@ private class ExposedSkinnableDrawable : SkinnableDrawable
public new Drawable Drawable => base.Drawable;
public ExposedSkinnableDrawable(string name, Func<ISkinComponent, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null,
ConfineMode confineMode = ConfineMode.ScaleDownToFit)
ConfineMode confineMode = ConfineMode.ScaleToFit)
: base(new TestSkinComponent(name), defaultImplementation, allowFallback, confineMode)
{
}

View File

@ -92,20 +92,13 @@ protected override void Update()
switch (confineMode)
{
case ConfineMode.NoScaling:
return;
case ConfineMode.ScaleDownToFit:
if (Drawable.DrawSize.X <= DrawSize.X && Drawable.DrawSize.Y <= DrawSize.Y)
return;
case ConfineMode.ScaleToFit:
Drawable.RelativeSizeAxes = Axes.Both;
Drawable.Size = Vector2.One;
Drawable.Scale = Vector2.One;
Drawable.FillMode = FillMode.Fit;
break;
}
Drawable.RelativeSizeAxes = Axes.Both;
Drawable.Size = Vector2.One;
Drawable.Scale = Vector2.One;
Drawable.FillMode = FillMode.Fit;
}
finally
{
@ -121,7 +114,6 @@ public enum ConfineMode
/// Don't apply any scaling. This allows the user element to be of any size, exceeding specified bounds.
/// </summary>
NoScaling,
ScaleDownToFit,
ScaleToFit,
}
}