Skip to content

Commit 625dc39

Browse files
authored
Merge branch 'sr_viz_main' into sr_viz_shiyang
2 parents ae3f01f + 9951ab6 commit 625dc39

5 files changed

Lines changed: 117 additions & 17 deletions

File tree

GEMstack/onboard/visualization/sr_viz/threeD/.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ node_modules/
33
.next/
44
out/
55

6+
/build
7+
68
# Python / Flask
79
__pycache__/
810
*.pyc
@@ -17,3 +19,31 @@ venv/
1719
.DS_Store
1820
.idea/
1921
.vscode/
22+
23+
# Yarn / PNP
24+
/.pnp
25+
.pnp.*
26+
.yarn/*
27+
!.yarn/patches
28+
!.yarn/plugins
29+
!.yarn/releases
30+
!.yarn/versions
31+
32+
# Testing
33+
/coverage
34+
35+
# Misc
36+
*.pem
37+
38+
# Debug logs
39+
npm-debug.log*
40+
yarn-debug.log*
41+
yarn-error.log*
42+
.pnpm-debug.log*
43+
44+
# Vercel
45+
.vercel
46+
47+
# TypeScript
48+
*.tsbuildinfo
49+
next-env.d.ts
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

GEMstack/onboard/visualization/sr_viz/threeD/src/components/ControlPanel.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export default function ControlPanel({
3939
console.error("Failed to parse log file:", err);
4040
}
4141
};
42+
const handleContextMenu = (event: React.MouseEvent) => {
43+
event.preventDefault();
44+
if (isOpen) {
45+
setIsOpen(false);
46+
} else {
47+
setIsOpen(true);
48+
}
49+
}
4250

4351
useEffect(() => {
4452
if (!folder || !file) return;
@@ -81,6 +89,7 @@ export default function ControlPanel({
8189
className={`fixed top-0 left-0 h-full w-64 bg-black/80 text-white shadow-lg transform transition-transform duration-500 ease-in-out z-40 ${
8290
isOpen ? "translate-x-0" : "-translate-x-full"
8391
}`}
92+
onContextMenu={handleContextMenu}
8493
>
8594
{isOpen && (
8695
<>
@@ -123,6 +132,7 @@ export default function ControlPanel({
123132
onClick={() => setIsOpen(true)}
124133
className="fixed top-1/2 left-0 -translate-y-1/2 z-50 bg-black/80 text-white w-3 h-8 flex items-center justify-center rounded-r hover:bg-black border-l border-white/20"
125134
title="Open Panel"
135+
onContextMenu={(e) => e.preventDefault()}
126136
>
127137
<span className="text-xs"></span>
128138
</button>

GEMstack/onboard/visualization/sr_viz/threeD/src/components/Scrubber.tsx

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client";
2-
import React, { useState, useRef } from "react";
2+
import React, { useState } from "react";
33
import { IconButton, Slider, Menu, MenuItem } from "@mui/material";
44
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
55
import PauseIcon from "@mui/icons-material/Pause";
@@ -13,7 +13,7 @@ export default function Scrubber({
1313
restart,
1414
setPlaybackSpeed,
1515
moveToTime,
16-
duration
16+
duration,
1717
}: {
1818
time: number;
1919
play: boolean;
@@ -27,6 +27,7 @@ export default function Scrubber({
2727
const [selectedSpeed, setSelectedSpeed] = useState<number>(1);
2828
const speedOptions = [0.5, 1, 1.5, 2, 3];
2929
const open = Boolean(anchorEl);
30+
const [isDragging, setIsDragging] = useState<boolean>(false);
3031
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
3132
setAnchorEl(event.currentTarget);
3233
};
@@ -38,32 +39,64 @@ export default function Scrubber({
3839
setPlaybackSpeed(speed);
3940
handleClose();
4041
};
41-
const handleSliderChange = (_: Event, newValue: number | number[]) => {
42-
if (typeof newValue === "number") {
43-
moveToTime(newValue);
44-
}
42+
const handleSliderChange = (_: Event, newValue: number) => {
43+
moveToTime(newValue);
4544
};
45+
const handleSliderChangeCommitted = () => {
46+
setIsDragging(false);
47+
}
4648
const formatDuration = (time: number) => {
4749
const minutes = Math.floor(time / 60);
4850
const seconds = Math.floor(time % 60);
49-
return `${minutes < 10 ? "0" : ""}${minutes}:${seconds < 10 ? "0" : ""}${seconds}`;
50-
}
51+
return `${minutes < 10 ? "0" : ""}${minutes}:${
52+
seconds < 10 ? "0" : ""
53+
}${seconds}`;
54+
};
55+
const handleContextMenu = (event: React.MouseEvent) => {
56+
event.preventDefault();
57+
};
5158
return (
52-
<div className="px-5 fixed bottom-5 left-1/6 h-20 w-2/3 bg-black/40 text-white shadow-lg rounded-full flex justify-center items-center">
53-
<IconButton size="large" onClick={togglePlay}>
59+
<div
60+
className="px-5 fixed bottom-5 left-1/6 h-20 w-2/3 bg-black/40 text-white shadow-lg rounded-full flex justify-center items-center"
61+
onContextMenu={handleContextMenu}
62+
>
63+
<IconButton
64+
size="large"
65+
onClick={togglePlay}
66+
sx={{ marginRight: "20px", color: "white" }}
67+
>
5468
{play ? (
5569
<PauseIcon fontSize="inherit" />
5670
) : (
5771
<PlayArrowIcon fontSize="inherit" />
5872
)}
5973
</IconButton>
60-
<div className="w-2/3 flex items-center">
61-
<div>{time < duration ? formatDuration(time) : formatDuration(duration)}</div>
62-
<Slider min={0} max={duration} step={0.000001} className="mx-8" disabled={duration === 0} onChange={handleSliderChange} value={time}/>
74+
<div className="w-2/3 flex items-center select-none text-xl">
75+
<div>
76+
{time < duration
77+
? formatDuration(time)
78+
: formatDuration(duration)}
79+
</div>
80+
<Slider
81+
key={isDragging ? undefined : Math.floor(time * 100)}
82+
min={0}
83+
max={duration}
84+
step={0.02}
85+
className="mx-8"
86+
disabled={duration === 0}
87+
onChange={handleSliderChange}
88+
onMouseDown={() => setIsDragging(true)}
89+
onChangeCommitted={handleSliderChangeCommitted}
90+
value={time}
91+
/>
6392
<div>{formatDuration(duration)}</div>
6493
</div>
65-
<div>
66-
<IconButton size="large" onClick={handleClick}>
94+
<div className="ml-5 flex flex-nowrap">
95+
<IconButton
96+
size="large"
97+
onClick={handleClick}
98+
sx={{ color: "white" }}
99+
>
67100
<SpeedIcon fontSize="inherit" />
68101
</IconButton>
69102
<Menu
@@ -89,7 +122,10 @@ export default function Scrubber({
89122
</MenuItem>
90123
))}
91124
</Menu>
92-
<IconButton size="large">
125+
<IconButton
126+
size="large"
127+
sx={{ marginLeft: "20px", color: "white" }}
128+
>
93129
<RefreshIcon fontSize="inherit" onClick={restart} />
94130
</IconButton>
95131
</div>

GEMstack/onboard/visualization/sr_viz/threeD/src/config/groundConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface GroundConfig {
1414
}
1515

1616
const groundConfig: GroundConfig = {
17-
size: [20000, 20000],
17+
size: [1000, 1000],
1818
position: [0, 0, 0],
1919
rotation: [0, 0, 0],
2020
cellSize: 1,

0 commit comments

Comments
 (0)