This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { autorun } from 'mobx'; | |
import { observer } from 'mobx-react-lite'; | |
import React, { useEffect, useRef } from 'react'; | |
import { useAppState } from 'src/store/context/AppStateProvider'; | |
/** Moves the pan of the canvas if a cursor leaves the edges of the canvas during a drag */ | |
export const AutoPan = observer(() => { | |
const { hoverState, dragState, cameraState, toolState, selectionState } = useAppState(); | |
/** A RAF for the autopan function */ | |
const autoPanAnimationFrame = useRef<number>(0); |