mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 22:28:20 +08:00
Use AutoSize for SkinnableHudComponents
This commit is contained in:
parent
59339aa4fd
commit
2540d6029c
@ -37,26 +37,26 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
protected SkinnableHUDComponent(ISkinComponent component, Func<ISkinComponent, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.NoScaling)
|
protected SkinnableHUDComponent(ISkinComponent component, Func<ISkinComponent, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.NoScaling)
|
||||||
: base(component, defaultImplementation, allowFallback, confineMode)
|
: base(component, defaultImplementation, allowFallback, confineMode)
|
||||||
{
|
{
|
||||||
SkinScaleX.BindValueChanged(x => Drawable.Scale = new Vector2(x.NewValue, Drawable.Scale.Y));
|
SkinScaleX.BindValueChanged(x => Scale = new Vector2(x.NewValue, Scale.Y));
|
||||||
SkinScaleY.BindValueChanged(y => Drawable.Scale = new Vector2(Drawable.Scale.X, y.NewValue));
|
SkinScaleY.BindValueChanged(y => Scale = new Vector2(Scale.X, y.NewValue));
|
||||||
|
|
||||||
SkinPositionX.BindValueChanged(x => Position = new Vector2(x.NewValue, Position.Y));
|
SkinPositionX.BindValueChanged(x => Position = new Vector2(x.NewValue, Position.Y));
|
||||||
SkinPositionY.BindValueChanged(y => Position = new Vector2(Position.X, y.NewValue));
|
SkinPositionY.BindValueChanged(y => Position = new Vector2(Position.X, y.NewValue));
|
||||||
|
|
||||||
SkinRotation.BindValueChanged(rotation => Drawable.Rotation = rotation.NewValue);
|
SkinRotation.BindValueChanged(rotation => Rotation = rotation.NewValue);
|
||||||
SkinAnchor.BindValueChanged(anchor =>
|
SkinAnchor.BindValueChanged(anchor => { Anchor = anchor.NewValue; });
|
||||||
{
|
|
||||||
Drawable.Anchor = anchor.NewValue;
|
RelativeSizeAxes = Axes.None;
|
||||||
});
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
|
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
|
||||||
{
|
{
|
||||||
SkinScaleX.Value = Drawable.Scale.X;
|
SkinScaleX.Value = Scale.X;
|
||||||
SkinScaleY.Value = Drawable.Scale.Y;
|
SkinScaleY.Value = Scale.Y;
|
||||||
SkinPositionX.Value = Position.X;
|
SkinPositionX.Value = Position.X;
|
||||||
SkinPositionY.Value = Position.Y;
|
SkinPositionY.Value = Position.Y;
|
||||||
SkinRotation.Value = Drawable.Rotation;
|
SkinRotation.Value = Rotation;
|
||||||
SkinAnchor.Value = Anchor;
|
SkinAnchor.Value = Anchor;
|
||||||
return base.OnInvalidate(invalidation, source);
|
return base.OnInvalidate(invalidation, source);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user