From cd856ec2e29d39bf43869c3604415ff754c113b6 Mon Sep 17 00:00:00 2001 From: Victor O Date: Fri, 26 Apr 2024 23:29:32 -0700 Subject: [PATCH] Feature/translation panel whitespace fixes (#253) Co-authored-by: Victor --- app/components/InputVector.tsx | 9 ++++---- .../ControlPanelSceneObject.tsx | 22 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/components/InputVector.tsx b/app/components/InputVector.tsx index d25b4c0d37..66a9ff5f0f 100644 --- a/app/components/InputVector.tsx +++ b/app/components/InputVector.tsx @@ -33,10 +33,11 @@ export const InputVector = ({ function handleOnChange() { const newVector = { - x: Number(xRef.current?.value), - y: Number(yRef.current?.value), - z: Number(zRef.current?.value), + x: xRef.current.value === "" ? "" : Number(xRef.current?.value), + y: yRef.current.value === "" ? "" : Number(yRef.current?.value), + z: zRef.current.value === "" ? "" : Number(zRef.current?.value), }; + onChange(newVector); } @@ -97,7 +98,7 @@ export const InputVector = ({ }; return ( -
+
X
{ // Convert the number back to a string with at least two decimal places const str = num.toFixed(2); return parseFloat(str); -} +}; // console.log(formatNumber("000123.4567")); // Outputs: "123.46" // console.log(formatNumber("000123.4")); // Outputs: "123.40" @@ -44,7 +44,6 @@ export const ControlPanelSceneObject = () => { setIsCollapsed(!isCollapsed); }; - const position = appUiState.controlPanel.currentSceneObject?.objectVectors?.position; const rotation = @@ -53,7 +52,6 @@ export const ControlPanelSceneObject = () => { appUiState.controlPanel.currentSceneObject?.objectVectors?.scale; const currentSceneObject = appUiState.controlPanel.currentSceneObject; - useEffect(() => { // TODO this causes a subtle bug because it renders way too many times. if (!appUiState.controlPanel.currentSceneObject) { @@ -229,9 +227,9 @@ export const ControlPanelSceneObject = () => {
Location
@@ -239,9 +237,9 @@ export const ControlPanelSceneObject = () => {
Rotation
@@ -250,9 +248,9 @@ export const ControlPanelSceneObject = () => {
Scale