mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 06:52:56 +08:00
Fix slider sometimes not updating relative anchor position
This commit is contained in:
parent
bab14dce31
commit
57b2d018a9
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private Container<DrawableSliderRepeat> repeatContainer;
|
private Container<DrawableSliderRepeat> repeatContainer;
|
||||||
private PausableSkinnableSound slidingSample;
|
private PausableSkinnableSound slidingSample;
|
||||||
|
|
||||||
private readonly LayoutValue drawSizeLayout;
|
private readonly LayoutValue relativeAnchorPositionLayout;
|
||||||
|
|
||||||
public DrawableSlider()
|
public DrawableSlider()
|
||||||
: this(null)
|
: this(null)
|
||||||
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
};
|
};
|
||||||
AddLayout(drawSizeLayout = new LayoutValue(Invalidation.DrawSize | Invalidation.MiscGeometry));
|
AddLayout(relativeAnchorPositionLayout = new LayoutValue(Invalidation.DrawSize | Invalidation.MiscGeometry));
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -190,6 +190,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
repeatContainer.Add(repeat);
|
repeatContainer.Add(repeat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
relativeAnchorPositionLayout.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ClearNestedHitObjects()
|
protected override void ClearNestedHitObjects()
|
||||||
@ -265,14 +267,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Size = SliderBody?.Size ?? Vector2.Zero;
|
Size = SliderBody?.Size ?? Vector2.Zero;
|
||||||
OriginPosition = SliderBody?.PathOffset ?? Vector2.Zero;
|
OriginPosition = SliderBody?.PathOffset ?? Vector2.Zero;
|
||||||
|
|
||||||
if (!drawSizeLayout.IsValid)
|
if (!relativeAnchorPositionLayout.IsValid)
|
||||||
{
|
{
|
||||||
Vector2 pos = Vector2.Divide(OriginPosition, DrawSize);
|
Vector2 pos = Vector2.Divide(OriginPosition, DrawSize);
|
||||||
foreach (var obj in NestedHitObjects)
|
foreach (var obj in NestedHitObjects)
|
||||||
obj.RelativeAnchorPosition = pos;
|
obj.RelativeAnchorPosition = pos;
|
||||||
Ball.RelativeAnchorPosition = pos;
|
Ball.RelativeAnchorPosition = pos;
|
||||||
|
|
||||||
drawSizeLayout.Validate();
|
relativeAnchorPositionLayout.Validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user