mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 00:02:56 +08:00
Merge pull request #23701 from EVAST9919/editor-timeline-fix
Fix editor timeline hitobjects popping in and out of existence
This commit is contained in:
commit
b4ab3c8921
@ -50,6 +50,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private readonly Container colouredComponents;
|
private readonly Container colouredComponents;
|
||||||
private readonly OsuSpriteText comboIndexText;
|
private readonly OsuSpriteText comboIndexText;
|
||||||
|
private readonly SamplePointPiece samplePointPiece;
|
||||||
|
private readonly DifficultyPointPiece? difficultyPointPiece;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ISkinSource skin { get; set; } = null!;
|
private ISkinSource skin { get; set; } = null!;
|
||||||
@ -101,7 +103,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new SamplePointPiece(Item)
|
samplePointPiece = new SamplePointPiece(Item)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre
|
||||||
@ -118,7 +120,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
if (item is IHasSliderVelocity)
|
if (item is IHasSliderVelocity)
|
||||||
{
|
{
|
||||||
AddInternal(new DifficultyPointPiece(Item)
|
AddInternal(difficultyPointPiece = new DifficultyPointPiece(Item)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.BottomCentre
|
Origin = Anchor.BottomCentre
|
||||||
@ -244,6 +246,25 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
public override Vector2 ScreenSpaceSelectionPoint => ScreenSpaceDrawQuad.TopLeft;
|
public override Vector2 ScreenSpaceSelectionPoint => ScreenSpaceDrawQuad.TopLeft;
|
||||||
|
|
||||||
|
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds)
|
||||||
|
{
|
||||||
|
// Since children are exceeding the component size, we need to use a custom quad to compute whether it should be masked away.
|
||||||
|
|
||||||
|
// If the component isn't considered masked away by itself, there's no need to apply custom logic.
|
||||||
|
if (!base.ComputeIsMaskedAway(maskingBounds))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If the component is considered masked away, we'll use children to create an extended quad that encapsulates all parts of this blueprint
|
||||||
|
// to ensure it doesn't pop in and out of existence abruptly when scrolling the timeline.
|
||||||
|
var rect = RectangleF.Union(ScreenSpaceDrawQuad.AABBFloat, circle.ScreenSpaceDrawQuad.AABBFloat);
|
||||||
|
rect = RectangleF.Union(rect, samplePointPiece.ScreenSpaceDrawQuad.AABBFloat);
|
||||||
|
|
||||||
|
if (difficultyPointPiece != null)
|
||||||
|
rect = RectangleF.Union(rect, difficultyPointPiece.ScreenSpaceDrawQuad.AABBFloat);
|
||||||
|
|
||||||
|
return !Precision.AlmostIntersects(maskingBounds, rect);
|
||||||
|
}
|
||||||
|
|
||||||
private partial class Tick : Circle
|
private partial class Tick : Circle
|
||||||
{
|
{
|
||||||
public Tick()
|
public Tick()
|
||||||
|
Loading…
Reference in New Issue
Block a user