From 41882ddf23bab978bf80be0d664ae771c65b1d12 Mon Sep 17 00:00:00 2001 From: GonnaHetzMe Date: Wed, 25 Mar 2026 01:12:06 +0100 Subject: [PATCH] fix: initialize tank quick inputs from current model transform --- .../Options/components/QuickInputs/index.tsx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/website/src/components/Tankopedia/HeroSection/components/Options/components/QuickInputs/index.tsx b/packages/website/src/components/Tankopedia/HeroSection/components/Options/components/QuickInputs/index.tsx index 97cb6faec..03e958c82 100644 --- a/packages/website/src/components/Tankopedia/HeroSection/components/Options/components/QuickInputs/index.tsx +++ b/packages/website/src/components/Tankopedia/HeroSection/components/Options/components/QuickInputs/index.tsx @@ -27,27 +27,29 @@ export function QuickInputs() { const hasDownImprovedVerticalStabilizer = useEquipment(124); useEffect(() => { - function handleTransformEvent( - event: QuicklimeEvent - ) { + function syncInputValues(data: ModelTransformEventData) { if (!pitchInput.current || !yawInput.current) return; pitchInput.current.value = ( - radToDeg(event.data.pitch) + + radToDeg(data.pitch) + (tankModelDefinition.initial_turret_rotation?.pitch ?? 0) ).toFixed(1); + yawInput.current.value = radToDeg(data.yaw).toFixed(1); + } - if (event.data.yaw === undefined) return; - - yawInput.current.value = radToDeg(event.data.yaw).toFixed(1); + function handleTransformEvent( + event: QuicklimeEvent + ) { + syncInputValues(event.data); } modelTransformEvent.on(handleTransformEvent); + syncInputValues(modelTransformEvent.last!); return () => { modelTransformEvent.off(handleTransformEvent); }; - }, []); + }, [initialGunPitch]); return ( { const value = Number(yawInput.current!.value); @@ -113,7 +115,9 @@ export function QuickInputs() { size="1" radius="full" style={{ flex: 1, textAlign: "right" }} - defaultValue="0.0" + defaultValue={( + radToDeg(modelTransformEvent.last!.pitch) + initialGunPitch + ).toFixed(1)} onBlur={() => { const value = Number(pitchInput.current!.value); if (isNaN(value)) {