import { useEffect } from "react";
import { VisualElementDragControls } from "./VisualElementDragControls.js";
import { useConstant } from "../../utils/use-constant.js";
function useDrag(props) {
  var groupDragControls = props.dragControls, visualElement = props.visualElement;
  var dragControls = useConstant(function() {
    return new VisualElementDragControls(visualElement);
  });
  useEffect(function() {
    return groupDragControls && groupDragControls.subscribe(dragControls);
  }, [dragControls, groupDragControls]);
  useEffect(function() {
    return dragControls.addListeners();
  }, [dragControls]);
}
export {
  useDrag
};
//# sourceMappingURL=use-drag.js.map
