try and make preset menu always clickable

This commit is contained in:
Ross
2025-06-30 09:29:57 +01:00
parent 86a7bd143f
commit 3a92f5afba
+16 -6
View File
@@ -407,7 +407,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
total: number, total: number,
windowCenter: string, windowCenter: string,
windowWidth: string, windowWidth: string,
slicePosition?: number, slicePosition: string,
}>>(() => }>>(() =>
Array(viewportGrid.rows * viewportGrid.cols).fill({ Array(viewportGrid.rows * viewportGrid.cols).fill({
index: 0, index: 0,
@@ -2018,7 +2018,10 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
// cursor: "pointer", // cursor: "pointer",
zIndex: activeViewport === i ? 10 : 1, zIndex: activeViewport === i ? 10 : 1,
}} }}
onClick={() => setActiveViewport(i)} onClick={() => {
setActiveViewport(i);
setViewportMenuOpen(false); // <-- Add this line to close the grid selector
}}
onDoubleClick={() => handleDoubleClick(i)} onDoubleClick={() => handleDoubleClick(i)}
> >
<button <button
@@ -2399,6 +2402,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
right: 8, right: 8,
bottom: 8, bottom: 8,
zIndex: 10, zIndex: 10,
pointerEvents: "auto", // <-- ensure pointer events are enabled
}} }}
> >
<div <div
@@ -2413,7 +2417,9 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
cursor: "pointer", cursor: "pointer",
position: "relative", position: "relative",
boxShadow: presetsOpenArr[i] ? "0 2px 8px rgba(0,0,0,0.3)" : undefined, boxShadow: presetsOpenArr[i] ? "0 2px 8px rgba(0,0,0,0.3)" : undefined,
pointerEvents: "auto", // <-- ensure pointer events are enabled
}} }}
onClick={e => e.stopPropagation()} // <-- prevent bubbling to viewport
> >
<div <div
style={{ style={{
@@ -2421,13 +2427,14 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
fontWeight: "bold", fontWeight: "bold",
userSelect: "none", userSelect: "none",
}} }}
onClick={() => onClick={e => {
e.stopPropagation(); // <-- prevent bubbling to viewport
setPresetsOpenArr(prev => { setPresetsOpenArr(prev => {
const next = [...prev]; const next = [...prev];
next[i] = !next[i]; next[i] = !next[i];
return next; return next;
}) });
} }}
> >
Presets Presets
<span style={{ float: "right", fontWeight: "normal" }}> <span style={{ float: "right", fontWeight: "normal" }}>
@@ -2444,7 +2451,9 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
zIndex: 11, zIndex: 11,
pointerEvents: "auto", // <-- ensure pointer events are enabled
}} }}
onClick={e => e.stopPropagation()} // <-- prevent bubbling to viewport
> >
{WINDOW_LEVEL_PRESETS.map((preset) => ( {WINDOW_LEVEL_PRESETS.map((preset) => (
<button <button
@@ -2462,7 +2471,8 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
fontSize: "13px", fontSize: "13px",
opacity: 0.9, opacity: 0.9,
}} }}
onClick={() => { onClick={e => {
e.stopPropagation(); // <-- prevent bubbling to viewport
handleApplyPreset(i, preset.center, preset.width); handleApplyPreset(i, preset.center, preset.width);
setPresetsOpenArr(prev => { setPresetsOpenArr(prev => {
const next = [...prev]; const next = [...prev];