fix(webui): align 3D model viewer layout and full-width control bar with video viewer

This commit is contained in:
yiling
2026-10-08 23:47:41 +08:00
parent 2e24646c8b
commit ae6cdc88da
3 changed files with 157 additions and 123 deletions
@@ -1,5 +1,6 @@
import React from 'react'
import { Play, Pause, RotateCcw, Maximize, Minimize, Minus, Plus, Download } from 'lucide-react'
import { cn } from '@/ui/lib/utils'
import { RulerSlider } from './ruler-slider'
export interface ModelControlBarProps {
@@ -44,35 +45,45 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
}
return (
<div className="absolute inset-x-0 bottom-4 z-20 flex justify-center px-4 pointer-events-none">
<div className="pointer-events-auto flex items-center gap-3 px-4 py-2 rounded-xl bg-card/90 backdrop-blur-md border border-border/80 shadow-xl w-full max-w-4xl text-foreground">
{/* Play/Pause & Degree Readout */}
<div className="flex items-center gap-3 shrink-0">
<div
className={cn(
'transition-all duration-300 ease-in-out z-20 text-foreground',
isFullScreen
? 'absolute bottom-0 left-0 right-0 px-4 py-3 bg-card/90 backdrop-blur-md border-t border-border'
: 'relative w-full bg-card border-t border-border px-4 py-3 z-10 transition-colors duration-200',
)}
>
{/* Top: Ruler Slider across full width */}
<div className="mb-3 px-1">
<RulerSlider currentDegree={currentDegree} onChange={onSeekDegree} />
</div>
{/* Bottom: Lower Controls Row */}
<div className="flex items-center justify-between text-foreground">
{/* Left Side: Play/Pause, Degree Readout, Reset Rotation */}
<div className="flex items-center gap-4">
<button
type="button"
onClick={togglePlay}
aria-label={isPlaying ? 'Pause' : 'Play'}
className="flex items-center justify-center w-8 h-8 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors shadow-xs"
className="hover:text-primary transition-colors"
data-testid="play-toggle"
data-playing={isPlaying}
>
{isPlaying ? <Pause className="w-4 h-4" /> : <Play className="w-4 h-4 ml-0.5" />}
{isPlaying ? (
<Pause className="w-6 h-6 fill-current" />
) : (
<Play className="w-6 h-6 fill-current" />
)}
</button>
<div
className="text-xs font-mono font-medium tabular-nums min-w-[76px]"
className="flex items-center gap-1 text-sm font-medium tabular-nums select-none min-w-[90px]"
data-testid="degree-readout"
>
{currentDegree}° / 360°
<span className="text-muted-foreground font-mono">{currentDegree}° / 360°</span>
</div>
</div>
{/* Ruler Slider */}
<div className="flex-1 min-w-[200px]">
<RulerSlider currentDegree={currentDegree} onChange={onSeekDegree} />
</div>
{/* Right Action Tools */}
<div className="flex items-center gap-2 shrink-0">
{/* Reset rotation to 0° */}
<button
type="button"
onClick={onResetRotation}
@@ -82,9 +93,12 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
>
<RotateCcw className="w-4 h-4" />
</button>
</div>
{/* Right Side: Zoom controls, Download, Fullscreen */}
<div className="flex items-center gap-2">
{/* Zoom controls */}
<div className="hidden sm:flex items-center gap-1 bg-muted/60 rounded-lg p-0.5 border border-border/40">
<div className="flex items-center gap-1 bg-muted/60 rounded-lg p-0.5 border border-border/40">
<button
type="button"
onClick={() => onZoomChange(Math.max(0.2, zoom - 0.2))}