mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 12:57:16 +00:00
fix(webui): prevent RulerSlider from collapsing to 0px width in control bar
- Use flex layout with flex-1 on left and right clusters to preserve center cluster width - Enforce min-w-[140px] and w-full on RulerSlider - Fix tooltip positioning and remove outer overflow-hidden
This commit is contained in:
@@ -59,9 +59,9 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
||||
)}
|
||||
>
|
||||
{/* Unified Single Row Controls */}
|
||||
<div className="grid grid-cols-[1fr_auto_1fr] items-center text-foreground gap-4">
|
||||
<div className="flex items-center justify-between text-foreground gap-4">
|
||||
{/* Left Side: Play/Pause, Degree Readout, Reset Rotation */}
|
||||
<div className="flex items-center gap-3 justify-start min-w-0">
|
||||
<div className="flex items-center gap-3 justify-start min-w-0 flex-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={togglePlay}
|
||||
@@ -96,7 +96,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
||||
</div>
|
||||
|
||||
{/* Center: RulerSlider with minus & plus buttons */}
|
||||
<div className="flex items-center gap-1.5 w-full max-w-[320px] justify-center mx-auto min-w-0">
|
||||
<div className="flex items-center gap-1.5 w-full max-w-[320px] justify-center mx-auto shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleStepDegree(-15)}
|
||||
@@ -111,7 +111,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
||||
<RulerSlider
|
||||
currentDegree={currentDegree}
|
||||
onChange={onSeekDegree}
|
||||
className="flex-1 min-w-0"
|
||||
className="flex-1 min-w-[140px]"
|
||||
/>
|
||||
|
||||
<button
|
||||
@@ -127,7 +127,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
||||
</div>
|
||||
|
||||
{/* Right Side: Zoom controls, Download, Fullscreen */}
|
||||
<div className="flex items-center gap-2 justify-end min-w-0">
|
||||
<div className="flex items-center gap-2 justify-end min-w-0 flex-1">
|
||||
{/* Zoom controls */}
|
||||
<div className="flex items-center gap-1 bg-muted/60 rounded-lg p-0.5 border border-border/40 shrink-0">
|
||||
<button
|
||||
|
||||
@@ -122,7 +122,7 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
||||
onPointerCancel={handlePointerUp}
|
||||
onKeyDown={handleKeyDown}
|
||||
className={cn(
|
||||
'relative select-none cursor-ew-resize flex flex-col justify-end h-9 touch-none overflow-hidden group',
|
||||
'relative select-none cursor-ew-resize flex flex-col justify-end h-9 touch-none w-full min-w-[140px] group',
|
||||
disabled && 'opacity-50 cursor-not-allowed',
|
||||
className,
|
||||
)}
|
||||
@@ -131,7 +131,7 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
||||
{isDragging && (
|
||||
<div
|
||||
data-testid="ruler-slider-tooltip"
|
||||
className="absolute -top-1 left-1/2 -translate-x-1/2 px-1.5 py-0.5 rounded bg-primary text-primary-foreground text-[10px] font-mono font-medium shadow-md whitespace-nowrap pointer-events-none z-30 animate-in fade-in zoom-in-95 duration-100"
|
||||
className="absolute -top-6 left-1/2 -translate-x-1/2 px-1.5 py-0.5 rounded bg-primary text-primary-foreground text-[10px] font-mono font-medium shadow-md whitespace-nowrap pointer-events-none z-30 animate-in fade-in zoom-in-95 duration-100"
|
||||
>
|
||||
{displayedDegree}°
|
||||
</div>
|
||||
@@ -143,8 +143,6 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
||||
style={{
|
||||
maskImage:
|
||||
'linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent)',
|
||||
webkitMaskImage:
|
||||
'linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent)',
|
||||
}}
|
||||
>
|
||||
{/* Baseline bar */}
|
||||
|
||||
Reference in New Issue
Block a user