Files
TheracUE/Source/MyProject/Private/MagicFloatInput.cpp

24 lines
637 B
C++
Raw Permalink Normal View History

// Fill out your copyright notice in the Description page of Project Settings.
#include "MagicFloatInput.h"
2025-05-09 16:02:07 +01:00
void UMagicFloatInput::HandleOnTextCommitted(
FText const & inText,
ETextCommit::Type inCommitMethod
) {
2025-05-09 22:20:16 +01:00
double x = 0.0;
2025-05-09 16:02:07 +01:00
if (inText.IsEmptyOrWhitespace()) {
if (sourceInput != nullptr) {
2025-05-09 22:20:16 +01:00
x = FCString::Atod(*sourceInput->GetText().ToString());
2025-05-09 15:32:49 +01:00
}
2025-05-09 22:20:16 +01:00
} else
x = FCString::Atod(*inText.ToString());
SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x)));
HandleMagicFloatsMangledEvent();
}
void UMagicFloatInput::HandleMagicFloatsMangledEvent() {
OnMagicFloatsMangled.ExecuteIfBound();
2025-05-09 22:20:16 +01:00
}