Files
automatisch/packages/web/src/components/EditorNew/useScrollBoundries.js
2024-06-04 07:18:18 +00:00

14 lines
311 B
JavaScript

import { useEffect } from 'react';
import { useViewport, useReactFlow } from 'reactflow';
export const useScrollBoundries = () => {
const { setViewport } = useReactFlow();
const { x, y, zoom } = useViewport();
useEffect(() => {
if (y > 0) {
setViewport({ x, y: 0, zoom });
}
}, [y]);
};