Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

708 B
Raw Blame
import { useDndContext } from '@dnd-kit/core';
import { useEffect } from 'react';

import { isGalleryBoardDragData, isGalleryItemDragData } from './galleryDnd';

/** Mount once inside DndContext: the body marker's global drag cursors override button and textarea cursors. */
export const GalleryDragCursor = () => {
  const { active } = useDndContext();
  const isGalleryDrag = isGalleryItemDragData(active?.data.current) || isGalleryBoardDragData(active?.data.current);

  useEffect(() => {
    if (!isGalleryDrag) {
      return;
    }

    document.body.setAttribute('data-gallery-drag', '');

    return () => document.body.removeAttribute('data-gallery-drag');
  }, [isGalleryDrag]);

  return null;
};