solid-dnd
solid-dnd copied to clipboard
What is the intended way to abort a drag operation, conditionally in this library?
The only way I've managed to accomplish this is by overriding onPointerDown on the draggable item and then use event.stopPropagation() when the condition is true.
However i quickly noticed that this method had some downsides. I need to play an animation on another element when the condition is true. Which now means that the animation will play as soon as someone clicks on the element and not only when a drag operation starts.
What is the intended way to solve this currently?
Edit example:
const TestComponent = () =>
{
const someCondition = createMemo<boolean>(() => false);
const handleDragStart: DragEventHandler = (e) =>
{
if(someCondition() == true)
{
//something like drag.abort() here or return false or something?
}
}
const handleDragEnd: DragEventHandler = (e) =>
{
//.. do stuff
}
return (
<DragDropProvider onDragStart={handleDragStart}
onDragEnd={handleDragEnd}>
</DragDropProvider>
)
}