@dnd-kit-svelte/svelte
Version:
[](https://npm.im/@dnd-kit-svelte/svelte)
18 lines (17 loc) • 628 B
JavaScript
import { useComputed } from '../../hooks/index.js';
import { useDragDropManager } from './use-drag-drop-manager.js';
export function useDragOperation() {
const manager = useDragDropManager();
// TODO: (haniel) there might be an issue with this,
// idk if it accounts for manager.current being reactive yet
const source = useComputed(() => manager.current?.dragOperation.source);
const target = useComputed(() => manager.current?.dragOperation.target);
return {
get source() {
return source.value;
},
get target() {
return target.value;
},
};
}