+ {/* Timeline with responsive layout - single row on desktop, double row on mobile */}
diff --git a/app/tl.tsx b/app/tl.tsx
index 47b95d5..41182bf 100644
--- a/app/tl.tsx
+++ b/app/tl.tsx
@@ -6,9 +6,17 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
-import { CalendarIcon, ChevronLeft, ChevronRight, HomeIcon, LockIcon, Pause, Play, RefreshCwIcon, UnlockIcon } from "lucide-react";
+import { CalendarIcon, ChevronLeft, ChevronRight, Clock, Dog, HomeIcon, LockIcon, MoreHorizontal, Pause, Play, Rabbit, RefreshCwIcon, Turtle, UnlockIcon } from "lucide-react";
import { formatInTimeZone } from "date-fns-tz";
import { parse } from "date-fns"
@@ -16,6 +24,8 @@ import { useTimeline } from "@/hooks/use-timeline";
import { Timeline as TimelineEngine, ZoomMode, TimelineConfig } from "@/lib/timeline";
import { Separator } from "@/components/ui/separator";
import { useWS } from "./ws-context";
+import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
+import { useIsMobile } from "@/hooks/use-mobile";
interface Uniforms {
@@ -87,8 +97,10 @@ export const Timeline: React.FC
= React.memo(({
});
const [open, setOpen] = useState(false)
const [time, setDateTime] = useState(new Date())
+ const [speed, setSpeed] = useState(1)
const { data } = useWS()
+ const isMobile = useIsMobile(1024) // Use lg breakpoint (1024px)
useEffect(() => {
if (data) {
@@ -112,13 +124,13 @@ export const Timeline: React.FC = React.memo(({
useEffect(() => {
let intervalId: NodeJS.Timeout | null = null;
- if (isPlaying) {
+ if (isPlaying && speed > 0) {
intervalId = setInterval(() => {
// 执行时间前进操作
if (timelineEngineRef.current) {
timelineEngineRef.current.playAndEnsureMarkInView(timeStep)
}
- }, 1000); // 每秒执行一次,你可以根据需要调整这个间隔
+ }, 600 / speed); // 每秒执行一次,你可以根据需要调整这个间隔
}
return () => {
@@ -126,7 +138,7 @@ export const Timeline: React.FC = React.memo(({
clearInterval(intervalId);
}
};
- }, [isPlaying, timeStep]);
+ }, [isPlaying, timeStep, speed]);
useEffect(() => {
if (!ticksCanvasRef.current) return;
@@ -263,123 +275,196 @@ export const Timeline: React.FC = React.memo(({
}, []);
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-