24 lines
637 B
C++
24 lines
637 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#include "MagicFloatInput.h"
|
|
|
|
void UMagicFloatInput::HandleOnTextCommitted(
|
|
FText const & inText,
|
|
ETextCommit::Type inCommitMethod
|
|
) {
|
|
double x = 0.0;
|
|
if (inText.IsEmptyOrWhitespace()) {
|
|
if (sourceInput != nullptr) {
|
|
x = FCString::Atod(*sourceInput->GetText().ToString());
|
|
}
|
|
} else
|
|
x = FCString::Atod(*inText.ToString());
|
|
|
|
SetText(FText::FromString(FString::Printf(TEXT("%.7f"), x)));
|
|
HandleMagicFloatsMangledEvent();
|
|
}
|
|
|
|
void UMagicFloatInput::HandleMagicFloatsMangledEvent() {
|
|
OnMagicFloatsMangled.ExecuteIfBound();
|
|
}
|