mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 05:14:25 +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 */}
|
{/* 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 */}
|
{/* 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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={togglePlay}
|
onClick={togglePlay}
|
||||||
@@ -96,7 +96,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Center: RulerSlider with minus & plus buttons */}
|
{/* 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
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => handleStepDegree(-15)}
|
onClick={() => handleStepDegree(-15)}
|
||||||
@@ -111,7 +111,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
|||||||
<RulerSlider
|
<RulerSlider
|
||||||
currentDegree={currentDegree}
|
currentDegree={currentDegree}
|
||||||
onChange={onSeekDegree}
|
onChange={onSeekDegree}
|
||||||
className="flex-1 min-w-0"
|
className="flex-1 min-w-[140px]"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -127,7 +127,7 @@ export const ModelControlBar: React.FC<ModelControlBarProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right Side: Zoom controls, Download, Fullscreen */}
|
{/* 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 */}
|
{/* Zoom controls */}
|
||||||
<div className="flex items-center gap-1 bg-muted/60 rounded-lg p-0.5 border border-border/40 shrink-0">
|
<div className="flex items-center gap-1 bg-muted/60 rounded-lg p-0.5 border border-border/40 shrink-0">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
|||||||
onPointerCancel={handlePointerUp}
|
onPointerCancel={handlePointerUp}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
className={cn(
|
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',
|
disabled && 'opacity-50 cursor-not-allowed',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
@@ -131,7 +131,7 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
|||||||
{isDragging && (
|
{isDragging && (
|
||||||
<div
|
<div
|
||||||
data-testid="ruler-slider-tooltip"
|
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}°
|
{displayedDegree}°
|
||||||
</div>
|
</div>
|
||||||
@@ -143,8 +143,6 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
|
|||||||
style={{
|
style={{
|
||||||
maskImage:
|
maskImage:
|
||||||
'linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent)',
|
'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 */}
|
{/* Baseline bar */}
|
||||||
|
|||||||
Reference in New Issue
Block a user