mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
TypewriterText: Make sure we calculate the wrapped text ahead of time
Failing to do this can cause some odd flickering in the desired size because it previously didn't apply until the first letter callback
This commit is contained in:
parent
485af3610f
commit
13627265c9
@ -108,6 +108,9 @@ void UTypewriterTextWidget::PlayLine(const FText& InLine, float Speed)
|
||||
|
||||
bHasFinishedPlaying = false;
|
||||
|
||||
LineText->SetText(FText());
|
||||
CalculateWrappedString();
|
||||
|
||||
FTimerDelegate Delegate;
|
||||
Delegate.BindUObject(this, &ThisClass::PlayNextLetter);
|
||||
|
||||
@ -135,11 +138,6 @@ void UTypewriterTextWidget::SkipToLineEnd()
|
||||
|
||||
void UTypewriterTextWidget::PlayNextLetter()
|
||||
{
|
||||
if (Segments.Num() == 0)
|
||||
{
|
||||
CalculateWrappedString();
|
||||
}
|
||||
|
||||
// Incorporate pauses as a multiple of play timer (may not be exact but close enough)
|
||||
if (PauseTime > 0)
|
||||
{
|
||||
@ -200,9 +198,10 @@ void UTypewriterTextWidget::CalculateWrappedString()
|
||||
const FGeometry& TextBoxGeometry = LineText->GetCachedGeometry();
|
||||
const FVector2D TextBoxSize = TextBoxGeometry.GetLocalSize();
|
||||
|
||||
Layout->ClearLines();
|
||||
Layout->SetWrappingWidth(TextBoxSize.X);
|
||||
Marshaller->SetText(CurrentLine.ToString(), *Layout.Get());
|
||||
Layout->UpdateIfNeeded();
|
||||
Layout->UpdateLayout();
|
||||
|
||||
bool bHasWrittenText = false;
|
||||
auto Views = Layout->GetLineViews();
|
||||
|
Loading…
x
Reference in New Issue
Block a user