Skip to content

Commit

Permalink
adjust the initial width size.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed May 4, 2022
1 parent d69b4a9 commit 01d1e03
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions osu.Framework.Font/Graphics/Sprites/KaraokeSpriteText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,22 +448,22 @@ public virtual void RefreshStateTransforms()
if (!hasTimeTag || !hasText)
return;

// todo: IApplicableToCharacterSize should affect padding in the masking container also.

// set initial width.
// we should get width from child object because draw width haven't updated.
var width = leftLyricText.Width;
leftLyricTextContainer.Width = 0;
rightLyricTextContainer.Width = width;
var startPosition = getTextIndexPosition(new TextIndex());
var endPosition = width - startPosition;
leftLyricTextContainer.Width = startPosition;
rightLyricTextContainer.Width = endPosition;

// get first time-tag relative start time.
var currentTime = Time.Current;
var relativeTime = validTimeTag.FirstOrDefault().Value;

// get transform sequence and set initial delay time.
var delay = relativeTime - currentTime;
var leftTransformSequence = leftLyricTextContainer.Delay(delay).ResizeWidthTo(0).Then();
var rightTransformSequence = rightLyricTextContainer.Delay(delay).ResizeWidthTo(width).Then();
var leftTransformSequence = leftLyricTextContainer.Delay(delay).ResizeWidthTo(startPosition).Then();
var rightTransformSequence = rightLyricTextContainer.Delay(delay).ResizeWidthTo(endPosition).Then();

foreach ((var textIndex, double time) in validTimeTag)
{
Expand Down

0 comments on commit 01d1e03

Please sign in to comment.