import { useContext } from 'react'; import { Transition } from "@headlessui/react"; import { faArrowRightArrowLeft, faCube, faTrash} from "@fortawesome/pro-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { AppUiContext } from '../../contexts/AppUiContext'; import { Button, H4, H6, InputVector } from "~/components"; import { XYZ } from '../../datastructures/common'; import { ACTION_TYPES } from '../../reducers/appUiReducer/types'; export const ControlPanelSceneObject = () => { const [appUiState, dispatchAppUiState ] = useContext(AppUiContext); const position = appUiState?.currentSceneObject.objectVectors.position; const rotation = appUiState?.currentSceneObject.objectVectors.rotation; const scalar = appUiState?.currentSceneObject.objectVectors.scalar; const handlePositionChange = (xyz:XYZ)=>{ if(appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload:{ currentSceneObject:{ objectVectors:{ position: {...xyz}, rotation: appUiState.currentSceneObject.objectVectors.rotation, scalar:appUiState.currentSceneObject.objectVectors.scalar, } } } }); } const handleRotationChange = (xyz:XYZ)=>{ if(appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload:{ currentSceneObject:{ objectVectors:{ position: appUiState.currentSceneObject.objectVectors.position, rotation: {...xyz}, scalar:appUiState.currentSceneObject.objectVectors.scalar, } } } }); } const handleScalarChange = (xyz:XYZ)=>{ if(appUiState) dispatchAppUiState({ type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT, payload:{ currentSceneObject:{ objectVectors:{ position: appUiState.currentSceneObject.objectVectors.position, rotation: appUiState.currentSceneObject.objectVectors.rotation, scalar:{...xyz}, } } } }); } return(

Object Name

Swap Object

Position

Rotation

Scale

); }