import { Handle } from '@daign/handle';
// Create the node which will initiate the drag, or reference it from your HTML.
const node = document.createElement( 'div' );
// Create the Handle.
const handle = new Handle();
handle.setStartNode( node );
// Callback to execute when drag starts.
handle.beginning = (): boolean => {
// Get the coordinates of the start event.
console.log( handle.start );
// Return value determines whether to continue the drag.
return true;
};
// Callback to execute during the drag.
handle.continuing = (): void => {
// Get the coordinates of the events during the drag.
console.log( handle.temp );
// Get the difference between start and temp position.
console.log( handle.delta );
};
// Callback to execute when the drag has ended.
handle.ending = (): void => {};