Update ui for view selection (#423)

This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-09-13 14:46:02 -07:00
1 parent 240e6d66a3
commit 2a629613ed
4 files changed
+51 -30

No files matched your search

+4 -5
View File
@@ -257,11 +257,10 @@ $sidebar-width: 100% !default;
$viewer_button_size: 50px; $viewer_button_size: 50px;
.ViewerWindow-camera-dropdown { .ViewerWindow-camera-toggle {
position: absolute; margin: auto;
margin: 10px; text-align: center;
top: 0px; margin-top: 10px;
right: $SidePanel-width + $viewer_button_size;
z-index: 1000; z-index: 1000;
} }
@@ -1,13 +1,10 @@
import * as THREE from 'three'; import * as THREE from 'three';
import React, { useContext, useEffect, useRef } from 'react'; import React, { useContext, useEffect, useRef } from 'react';
import Select, { SelectChangeEvent } from '@mui/material/Select'; import { SelectChangeEvent } from '@mui/material/Select';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import FormControl from '@mui/material/FormControl'; import { IconButton, ToggleButtonGroup, ToggleButton } from '@mui/material';
import { IconButton } from '@mui/material';
import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import OpenWithIcon from '@mui/icons-material/OpenWith'; import OpenWithIcon from '@mui/icons-material/OpenWith';
import PublicOffSharpIcon from '@mui/icons-material/PublicOffSharp'; import PublicOffSharpIcon from '@mui/icons-material/PublicOffSharp';
import PublicSharpIcon from '@mui/icons-material/PublicSharp'; import PublicSharpIcon from '@mui/icons-material/PublicSharp';
@@ -27,11 +24,8 @@ function createStats() {
return stats; return stats;
} }
function CameraDropdown() { function CameraToggle() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const camera_options = useSelector(
(state) => state.renderingState.camera_options,
);
const camera_choice = useSelector( const camera_choice = useSelector(
(state) => state.renderingState.camera_choice, (state) => state.renderingState.camera_choice,
); );
@@ -44,19 +38,19 @@ function CameraDropdown() {
}); });
}; };
const menu_items = camera_options.map((camera_option) => (
<MenuItem key={camera_option} value={camera_option}>
{camera_option}
</MenuItem>
));
return ( return (
<FormControl sx={{ m: 1, minWidth: 120 }} size="small"> <ToggleButtonGroup
<InputLabel>Camera</InputLabel> color="primary"
<Select value={camera_choice} label="Age" onChange={set_camera_choice}> value={camera_choice}
{menu_items} exclusive
</Select> onChange={set_camera_choice}
</FormControl> aria-label="camera view"
size="small"
varient="filled"
>
<ToggleButton value="Main Camera">Viewport</ToggleButton>
<ToggleButton value="Render Camera">Render</ToggleButton>
</ToggleButtonGroup>
); );
} }
@@ -272,9 +266,10 @@ export default function ViewerWindow(props) {
<> <>
{/* the webrtc viewer needs to know the camera pose */} {/* the webrtc viewer needs to know the camera pose */}
<WebRtcWindow /> <WebRtcWindow />
<div className="canvas-container-main" ref={myRef} /> <div className="canvas-container-main" ref={myRef}>
<div className="ViewerWindow-camera-dropdown"> <div className="ViewerWindow-camera-toggle">
<CameraDropdown /> <CameraToggle />
</div>
</div> </div>
<div className="ViewerWindow-buttons"> <div className="ViewerWindow-buttons">
<TransformIcons sceneTree={sceneTree} /> <TransformIcons sceneTree={sceneTree} />
-1
View File
@@ -15,7 +15,6 @@ const initialState = {
// the rendering state // the rendering state
renderingState: { renderingState: {
// cameras // cameras
camera_options: ['Main Camera', 'Render Camera'], // the possible camera names to render the scene
camera_choice: 'Main Camera', // the camera being used to render the scene camera_choice: 'Main Camera', // the camera being used to render the scene
// camera path information // camera path information
+28
View File
@@ -95,5 +95,33 @@ export const appTheme = createTheme({
}, },
}, },
}, },
MuiToggleButtonGroup: {
styleOverrides: {
root: {
color: '#eeeeee',
backgroundColor: '#393e46',
'&.Mui-disabled': {
color: '#999999',
backgroundColor: '#393e46',
},
},
},
},
MuiToggleButton: {
styleOverrides: {
root: {
color: '#eeeeee',
backgroundColor: '#393e46',
'&.Mui-selected': {
color: '#FFD369',
backgroundColor: '#555555',
},
'&.Mui-disabled': {
color: '#999999',
backgroundColor: '#393e46',
},
},
},
},
}, },
}); });