chore(autoPanOnNodeFocus): cleanup

This commit is contained in:
moklick
2025-06-10 09:19:23 +02:00
parent 1a25bff52b
commit 34274eb44d
5 changed files with 10 additions and 10 deletions
@@ -29,7 +29,6 @@ export function NodeWrapper<NodeType extends Node>({
onContextMenu,
onDoubleClick,
nodesDraggable,
autoPanOnNodeFocus,
elementsSelectable,
nodesConnectable,
nodesFocusable,
@@ -162,11 +161,16 @@ export function NodeWrapper<NodeType extends Node>({
};
const onFocus = () => {
if (disableKeyboardA11y || !autoPanOnNodeFocus || !nodeRef.current?.matches(':focus-visible')) {
if (disableKeyboardA11y || !nodeRef.current?.matches(':focus-visible')) {
return;
}
const { transform, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
if (!autoPanOnNodeFocus) {
return;
}
const { transform, width, height, setCenter } = store.getState();
const withinViewport =
getNodesInside(new Map([[id, node]]), { x: 0, y: 0, width, height }, transform, true).length > 0;