From 49bcc86c4ecf780201046140f2fafa1329ccb16c Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Tue, 11 Mar 2025 12:43:12 -0400 Subject: [PATCH] Fix manual height not submitting form value (#1342) Co-authored-by: lucas lelievre --- .../scaled-steps/ManualHeightStep.tsx | 161 ++++++++---------- 1 file changed, 75 insertions(+), 86 deletions(-) diff --git a/gui/src/components/onboarding/pages/body-proportions/scaled-steps/ManualHeightStep.tsx b/gui/src/components/onboarding/pages/body-proportions/scaled-steps/ManualHeightStep.tsx index bed4b442b..6ef146f4c 100644 --- a/gui/src/components/onboarding/pages/body-proportions/scaled-steps/ManualHeightStep.tsx +++ b/gui/src/components/onboarding/pages/body-proportions/scaled-steps/ManualHeightStep.tsx @@ -35,8 +35,8 @@ export function ManualHeightStep({ }) { const { state } = useOnboarding(); const { l10n } = useLocalization(); - const { hmdHeight, setHmdHeight } = useHeightContext(); - const { control, handleSubmit } = useForm({ + const { setHmdHeight } = useHeightContext(); + const { control, handleSubmit, formState } = useForm({ defaultValues: { height: 1.5 }, }); const { sendRPCPacket } = useWebsocketAPI(); @@ -64,99 +64,88 @@ export function ManualHeightStep({ [currentLocales] ); - handleSubmit((values) => { + const submitHmdHeight = (values: HeightForm) => { setHmdHeight(values.height); - }); + const settingsRequest = new ChangeSettingsRequestT(); + settingsRequest.modelSettings = new ModelSettingsT( + null, + null, + null, + new SkeletonHeightT(values.height, 0) + ); + sendRPCPacket(RpcMessage.ChangeSettingsRequest, settingsRequest); + nextStep(); + }; return ( - <> -
-
-
- +
+
+
+ + {l10n.getString( + 'onboarding-scaled_proportions-manual_height-title' + )} + +
+ {l10n.getString( - 'onboarding-scaled_proportions-manual_height-title' + 'onboarding-scaled_proportions-manual_height-description' )} -
- - {l10n.getString( - 'onboarding-scaled_proportions-manual_height-description' - )} - - {/* }} - > - - Input your height manually! - - */} - {missingSteamConnection && ( -
- }} - // TODO: Add link to docs! - > - You don't have SteamVR connected! - -
+ {missingSteamConnection && ( +
+ }} + // TODO: Add link to docs! + > + You don't have SteamVR connected! + +
+ )} +
+
+ - - - isNaN(value) - ? l10n.getString( - 'onboarding-scaled_proportions-manual_height-unknown' - ) - : mFormat.format(value) - } - min={MIN_HEIGHT} - max={4} - step={0.01} - showButtonWithNumber - doubleStep={0.1} - /> - + valueLabelFormat={(value) => + isNaN(value) + ? l10n.getString( + 'onboarding-scaled_proportions-manual_height-unknown' + ) + : mFormat.format(value) + } + min={MIN_HEIGHT} + max={4} + step={0.01} + showButtonWithNumber + doubleStep={0.1} + />
- -
- {!state.alonePage && ( - - )} - -
- + +
+ {!state.alonePage && ( + + )} + +
+ ); }