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