Tldraw/packages/editor/src/lib/hooks/useIsCropping.ts

9 wiersze
296 B
TypeScript

import { useValue } from '@tldraw/state'
import { TLShapeId } from '@tldraw/tlschema'
import { useEditor } from './useEditor'
export function useIsCropping(shapeId: TLShapeId) {
const editor = useEditor()
return useValue('isCropping', () => editor.croppingId === shapeId, [editor, shapeId])
}