cables now start at the top of the sidewall and dont go into the roof, added skeletons to the bin page for when it is loading, also fixed an issue with the camera being very zoomed in sometimes when the page loads
This commit is contained in:
parent
f6de509561
commit
87382dd5d8
6 changed files with 27 additions and 11 deletions
|
|
@ -82,6 +82,9 @@ export default function OrbitCameraControls(props: Props) {
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Sync radius whenever initialRadius prop changes (e.g. after bin data loads)
|
||||||
|
spherical.current.radius = initialRadius ?? 10;
|
||||||
|
|
||||||
const canvas = gl.domElement;
|
const canvas = gl.domElement;
|
||||||
canvas.addEventListener("contextmenu", e => e.preventDefault());
|
canvas.addEventListener("contextmenu", e => e.preventDefault());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,8 @@ export function BuildCableData(bin: Bin, dims: BinDims): CableData[] {
|
||||||
distributed.forEach(orbit => {
|
distributed.forEach(orbit => {
|
||||||
const count = orbit.assignedCount ?? 0;
|
const count = orbit.assignedCount ?? 0;
|
||||||
|
|
||||||
const topY = getTopY(orbit.radius, dims);
|
// const topY = getTopY(orbit.radius, dims); //this is if we want the cables to start at the roof
|
||||||
|
const topY = dims.sidewallHeight/2 //this will start the cables at the top of the sidewall
|
||||||
const bottomY = getBottomY(orbit.radius, dims);
|
const bottomY = getBottomY(orbit.radius, dims);
|
||||||
|
|
||||||
if (orbit.orbit === 0 && count > 0) {
|
if (orbit.orbit === 0 && count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ export default function Bin3dView(props: Props) {
|
||||||
const diameter = dims.diameter / scale;
|
const diameter = dims.diameter / scale;
|
||||||
const largestDim = Math.max(totalHeight, diameter);
|
const largestDim = Math.max(totalHeight, diameter);
|
||||||
const fovRad = (75 * Math.PI) / 180;
|
const fovRad = (75 * Math.PI) / 180;
|
||||||
const padding = 1.3; // 30% breathing room
|
// const padding = 1.3; // 30% breathing room
|
||||||
|
const padding = 1.3 + (largestDim / 100) * 2; //more dynamic breathing room based on the bin size
|
||||||
return (largestDim / (2 * Math.tan(fovRad / 2))) * padding;
|
return (largestDim / (2 * Math.tan(fovRad / 2))) * padding;
|
||||||
}, [dims, scale]);
|
}, [dims, scale]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Box, Card, DialogContent, DialogTitle, Grid2, IconButton, LinearProgress, Slider, Switch, Tooltip, Typography } from "@mui/material";
|
import { Box, Card, DialogContent, DialogTitle, Grid2, IconButton, LinearProgress, Skeleton, Slider, Switch, Tooltip, Typography } from "@mui/material";
|
||||||
import { useMobile } from "hooks";
|
import { useMobile } from "hooks";
|
||||||
import { Bin, Component, Device } from "models";
|
import { Bin, Component, Device } from "models";
|
||||||
import Bin3dVisualizer from "../bin3dVisualizer";
|
import Bin3dVisualizer from "../bin3dVisualizer";
|
||||||
|
|
@ -23,6 +23,7 @@ import BinPlayer from "bin/BinPlayer";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
bin: Bin
|
bin: Bin
|
||||||
|
loading?: boolean,
|
||||||
devices: Device[]
|
devices: Device[]
|
||||||
cables?: GrainCable[]
|
cables?: GrainCable[]
|
||||||
plenums?: Plenum[]
|
plenums?: Plenum[]
|
||||||
|
|
@ -40,7 +41,7 @@ interface Props {
|
||||||
|
|
||||||
}
|
}
|
||||||
export default function BinSummary(props: Props){
|
export default function BinSummary(props: Props){
|
||||||
const {bin, devices, fans, heaters, permissions, componentDevices, componentMap, binPrefs, updateBinCallback, cables = [], plenums = [], setPreferences, setBin} = props
|
const {bin, loading, devices, fans, heaters, permissions, componentDevices, componentMap, binPrefs, updateBinCallback, cables = [], plenums = [], setPreferences, setBin} = props
|
||||||
//const [currentDevice, setCurrentDevice] = useState<Device | undefined>(undefined)
|
//const [currentDevice, setCurrentDevice] = useState<Device | undefined>(undefined)
|
||||||
const isMobile = useMobile()
|
const isMobile = useMobile()
|
||||||
const [openGrainDialog, setOpenGrainDialog] = useState(false)
|
const [openGrainDialog, setOpenGrainDialog] = useState(false)
|
||||||
|
|
@ -387,9 +388,12 @@ export default function BinSummary(props: Props){
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ChangeGrainDialog bin={bin} open={openGrainDialog} closeDialog={()=>setOpenGrainDialog(false)} permissions={permissions} updateBin={updateBinCallback}/>
|
<ChangeGrainDialog bin={bin} open={openGrainDialog} closeDialog={()=>setOpenGrainDialog(false)} permissions={permissions} updateBin={updateBinCallback}/>
|
||||||
{isMobile ? inventorySummaryMobile() : inventorySummaryDesktop()}
|
{loading ? <Skeleton variant="rectangular" height={100} sx={{marginBottom: 2}} /> : isMobile ? inventorySummaryMobile() : inventorySummaryDesktop()}
|
||||||
<Grid2 container spacing={2}>
|
<Grid2 container spacing={2}>
|
||||||
<Grid2 size={isMobile ? 12 : 7}>
|
<Grid2 size={isMobile ? 12 : 7}>
|
||||||
|
{loading ?
|
||||||
|
<Skeleton variant="rectangular" height={600}/>
|
||||||
|
:
|
||||||
<Card raised sx={{height: 600, position: "relative"}}>
|
<Card raised sx={{height: 600, position: "relative"}}>
|
||||||
<Bin3dVisualizer
|
<Bin3dVisualizer
|
||||||
bin={bin}
|
bin={bin}
|
||||||
|
|
@ -409,8 +413,12 @@ export default function BinSummary(props: Props){
|
||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
</Card>
|
</Card>
|
||||||
|
}
|
||||||
</Grid2>
|
</Grid2>
|
||||||
<Grid2 size={isMobile ? 12 : 5}>
|
<Grid2 size={isMobile ? 12 : 5}>
|
||||||
|
{loading ?
|
||||||
|
<Skeleton variant="rectangular" height={600}/>
|
||||||
|
:
|
||||||
<Card raised sx={{ height: 600, display: "flex", flexDirection: "column", overflow: "hidden" }}>
|
<Card raised sx={{ height: 600, display: "flex", flexDirection: "column", overflow: "hidden" }}>
|
||||||
<BinDetails
|
<BinDetails
|
||||||
bin={bin}
|
bin={bin}
|
||||||
|
|
@ -422,11 +430,17 @@ export default function BinSummary(props: Props){
|
||||||
cables={cables}
|
cables={cables}
|
||||||
plenums={plenums}/>
|
plenums={plenums}/>
|
||||||
</Card>
|
</Card>
|
||||||
|
}
|
||||||
</Grid2>
|
</Grid2>
|
||||||
<Grid2 size={12}>
|
<Grid2 size={12}>
|
||||||
|
{loading ?
|
||||||
|
<Skeleton variant="rectangular" height={250}/>
|
||||||
|
:
|
||||||
<Card>
|
<Card>
|
||||||
<BinSensorsDisplay components={componentMap} bin={bin} preferences={binPrefs} setPreferences={setPreferences} componentDevices={componentDevices}/>
|
<BinSensorsDisplay components={componentMap} bin={bin} preferences={binPrefs} setPreferences={setPreferences} componentDevices={componentDevices}/>
|
||||||
</Card>
|
</Card>
|
||||||
|
}
|
||||||
|
|
||||||
</Grid2>
|
</Grid2>
|
||||||
</Grid2>
|
</Grid2>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ import ButtonGroup from "common/ButtonGroup";
|
||||||
import BinTransactions from "bin/BinTransactions";
|
import BinTransactions from "bin/BinTransactions";
|
||||||
import { CO2 } from "models/CO2";
|
import { CO2 } from "models/CO2";
|
||||||
import ObjectInteractions from "objects/objectInteractions/ObjectInteractions";
|
import ObjectInteractions from "objects/objectInteractions/ObjectInteractions";
|
||||||
import Bin3dView from "bin/3dView/Scene/Bin3dView";
|
|
||||||
|
|
||||||
interface TabPanelProps {
|
interface TabPanelProps {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
|
|
@ -780,8 +779,6 @@ export default function Bin(props: Props) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const [fillPercent, setFillPercent] = useState(0)
|
|
||||||
|
|
||||||
const desktopView = () => {
|
const desktopView = () => {
|
||||||
return (
|
return (
|
||||||
<Card sx={{ padding: 1 }}>
|
<Card sx={{ padding: 1 }}>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { Pressure } from "models/Pressure";
|
||||||
import { CO2 } from "models/CO2";
|
import { CO2 } from "models/CO2";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { quack } from "protobuf-ts/quack";
|
import { quack } from "protobuf-ts/quack";
|
||||||
import { Box, Drawer, Grid2 as Grid, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Tab, Tabs, Theme, Tooltip } from "@mui/material";
|
import { Box, CircularProgress, Drawer, Grid2 as Grid, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Tab, Tabs, Theme, Tooltip } from "@mui/material";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import NotesIcon from "@mui/icons-material/Notes";
|
import NotesIcon from "@mui/icons-material/Notes";
|
||||||
import TasksIcon from "products/Construction/TasksIcon";
|
import TasksIcon from "products/Construction/TasksIcon";
|
||||||
|
|
@ -83,7 +83,6 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
|
|
||||||
|
|
||||||
export default function BinV2(){
|
export default function BinV2(){
|
||||||
const warningThreshold = 6;
|
|
||||||
const isMobile = useMobile();
|
const isMobile = useMobile();
|
||||||
const binID = useParams<{ binID: string }>()?.binID ?? "";
|
const binID = useParams<{ binID: string }>()?.binID ?? "";
|
||||||
const binAPI = useBinAPI();
|
const binAPI = useBinAPI();
|
||||||
|
|
@ -537,6 +536,7 @@ export default function BinV2(){
|
||||||
{pageHeader()}
|
{pageHeader()}
|
||||||
<BinSummary
|
<BinSummary
|
||||||
bin={bin}
|
bin={bin}
|
||||||
|
loading={binLoading}
|
||||||
devices={devices}
|
devices={devices}
|
||||||
fans={fans}
|
fans={fans}
|
||||||
heaters={heaters}
|
heaters={heaters}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue