Add graph viewport drag plane

This commit is contained in:
Meta Vens 2026-05-23 15:47:16 +01:00
commit 08ba4219bc

View file

@ -818,6 +818,36 @@ export function EpiphanyGraphViewer({
</g>
</svg>
)}
{status === "ready" && activeLayout && (
<div
aria-hidden="true"
onPointerDown={(event) => {
if (event.button !== 0 && !isMiddlePointerEvent(event)) {
return;
}
handleViewportPointerDown(event, activeTransform, dragRef);
}}
onPointerMove={(event) =>
handleViewportPointerMove(event, activeGraphKey, dragRef, setTransforms)
}
onPointerUp={(event) => handleViewportPointerUp(event, dragRef)}
onPointerCancel={(event) => handleViewportPointerUp(event, dragRef)}
onAuxClick={(event) => {
if (isMiddleMouseEvent(event)) {
event.preventDefault();
event.stopPropagation();
}
}}
style={{
position: "absolute",
inset: 0,
zIndex: 3,
cursor: dragRef.current?.active ? "grabbing" : "grab",
touchAction: "none",
}}
/>
)}
{status === "ready" && activeLayout && (
<div
aria-label={`${labels[activeGraphKey]} node surfaces`}