scope oncontextmenu correctly
This commit is contained in:
@@ -148,6 +148,7 @@ type AppProps = {
|
|||||||
|
|
||||||
// App definintion
|
// App definintion
|
||||||
function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewerState, ...props }: AppProps) {
|
function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewerState, ...props }: AppProps) {
|
||||||
|
const appRootRef = useRef<HTMLDivElement>(null);
|
||||||
const elementRef = useRef<HTMLDivElement>(null)
|
const elementRef = useRef<HTMLDivElement>(null)
|
||||||
const running = useRef(false)
|
const running = useRef(false)
|
||||||
|
|
||||||
@@ -1173,15 +1174,17 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const el = appRootRef.current;
|
||||||
|
if (!el) return;
|
||||||
const handleContextMenu = (e: MouseEvent) => {
|
const handleContextMenu = (e: MouseEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
document.addEventListener("contextmenu", handleContextMenu);
|
el.addEventListener("contextmenu", handleContextMenu);
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("contextmenu", handleContextMenu);
|
el.removeEventListener("contextmenu", handleContextMenu);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!referenceLinesEnabled) return;
|
if (!referenceLinesEnabled) return;
|
||||||
@@ -2852,7 +2855,9 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
// App root
|
// App root
|
||||||
<div style={{
|
<div
|
||||||
|
ref={appRootRef}
|
||||||
|
style={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
inset: 0,
|
inset: 0,
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
|||||||
Reference in New Issue
Block a user