Skip to content

What is the intended way to abort a drag operation, conditionally in this library? #118

Description

@Azravos

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>
    )
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions