feat: introduce style and behavior improvements
This commit is contained in:

committed by
Ali BARIN

parent
737eb31776
commit
f08dc25711
13
packages/web/src/components/EditorNew/useScrollBoundries.js
Normal file
13
packages/web/src/components/EditorNew/useScrollBoundries.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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]);
|
||||
};
|
Reference in New Issue
Block a user