Enhance right-side stack panel interaction with hover button and settings button adjustments
This commit is contained in:
+42
-14
@@ -178,6 +178,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
|
|
||||||
// Right-side stack panel open state (toggled by button)
|
// Right-side stack panel open state (toggled by button)
|
||||||
const [stackPanelOpen, setStackPanelOpen] = useState(false);
|
const [stackPanelOpen, setStackPanelOpen] = useState(false);
|
||||||
|
const [showOpenButtonHover, setShowOpenButtonHover] = useState(false);
|
||||||
|
|
||||||
const [fullscreenHoverIdx, setFullscreenHoverIdx] = useState<number | null>(null);
|
const [fullscreenHoverIdx, setFullscreenHoverIdx] = useState<number | null>(null);
|
||||||
const [openDropdownIdx, setOpenDropdownIdx] = useState<number | null>(null);
|
const [openDropdownIdx, setOpenDropdownIdx] = useState<number | null>(null);
|
||||||
@@ -2992,32 +2993,39 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
|
|
||||||
{/* Right-side stack panel is implemented in the main content flex container below */}
|
{/* Right-side stack panel is implemented in the main content flex container below */}
|
||||||
|
|
||||||
{/* Floating right-edge toggle — always visible so users can open the panel */}
|
{/* Right-edge hover strip to reveal open button */}
|
||||||
{!stackPanelOpen && (
|
<div
|
||||||
|
onMouseEnter={() => { if (!stackPanelOpen) setShowOpenButtonHover(true); }}
|
||||||
|
onMouseLeave={() => { if (!stackPanelOpen) setShowOpenButtonHover(false); }}
|
||||||
|
style={{ position: 'absolute', right: 0, top: 0, height: '100%', width: 56, zIndex: 2400, pointerEvents: stackPanelOpen ? 'none' : 'auto' }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Open button only visible when hover strip is active */}
|
||||||
|
{showOpenButtonHover && !stackPanelOpen && (
|
||||||
<button
|
<button
|
||||||
onClick={() => setStackPanelOpen(true)}
|
onClick={() => setStackPanelOpen(true)}
|
||||||
|
onMouseEnter={() => setShowOpenButtonHover(true)}
|
||||||
|
onMouseLeave={() => setShowOpenButtonHover(false)}
|
||||||
aria-pressed={false}
|
aria-pressed={false}
|
||||||
title="Open stacks"
|
title="Open stacks"
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
right: 8,
|
right: 14,
|
||||||
top: '50%',
|
top: '50%',
|
||||||
transform: 'translateY(-50%)',
|
transform: 'translateY(-50%)',
|
||||||
zIndex: 2500,
|
zIndex: 2700,
|
||||||
width: 24,
|
width: 28,
|
||||||
height: 24,
|
height: 48,
|
||||||
padding: 0,
|
|
||||||
background: '#1976d2',
|
background: '#1976d2',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
border: 'none',
|
border: 'none',
|
||||||
borderRadius: 4,
|
borderRadius: 6,
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
boxShadow: '0 1px 4px rgba(0,0,0,0.25)',
|
boxShadow: '0 2px 8px rgba(0,0,0,0.3)',
|
||||||
lineHeight: 1,
|
pointerEvents: 'auto'
|
||||||
fontSize: 12,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
▶
|
▶
|
||||||
@@ -3407,10 +3415,30 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{viewports}
|
{viewports}
|
||||||
|
{/* Settings button positioned relative to the viewport area so it doesn't shift when the right panel opens */}
|
||||||
|
<button
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 8,
|
||||||
|
right: 8,
|
||||||
|
zIndex: 2600,
|
||||||
|
padding: '6px 12px',
|
||||||
|
background: '#222',
|
||||||
|
color: '#fff',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
opacity: 0.85,
|
||||||
|
userSelect: 'none',
|
||||||
|
}}
|
||||||
|
onClick={() => setSettingsOpen(true)}
|
||||||
|
>
|
||||||
|
Settings
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right-side panel occupies layout space when visible or pinned */}
|
{/* Right-side panel occupies layout space when visible; when closed width is 0 and it doesn't catch pointer events */}
|
||||||
<div style={{ width: stackPanelOpen ? 320 : 28, transition: 'width 220ms ease', display: 'flex', flexDirection: 'column', pointerEvents: 'auto' }}>
|
<div style={{ width: stackPanelOpen ? 320 : 0, transition: 'width 220ms ease', display: 'flex', flexDirection: 'column', pointerEvents: stackPanelOpen ? 'auto' : 'none', overflow: 'hidden' }}>
|
||||||
{/* Reuse the existing right-side panel markup but ensure pointerEvents are enabled inside */}
|
{/* Reuse the existing right-side panel markup but ensure pointerEvents are enabled inside */}
|
||||||
<div style={{ pointerEvents: 'auto', width: '100%', height: '100%' }}>
|
<div style={{ pointerEvents: 'auto', width: '100%', height: '100%' }}>
|
||||||
{/* Panel (same content as before) */}
|
{/* Panel (same content as before) */}
|
||||||
@@ -3498,7 +3526,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 8,
|
top: 8,
|
||||||
left: sideMenuOpen ? 250 + 16 : 16,
|
left: sideMenuOpen ? 250 + 16 : 16,
|
||||||
zIndex: 2600,
|
zIndex: 2800,
|
||||||
padding: "6px 12px",
|
padding: "6px 12px",
|
||||||
background: "#222",
|
background: "#222",
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
|
|||||||
Reference in New Issue
Block a user