dragulaangular-dragula

Draw line when dragging element?


Is it possible to draw line between the container and a draggable element during dragging using 'dragula' lib? When the element is dropped, the line should disappear.


Solution

  • <div [dragula]='"my-bag"'>
        <div class="draggable-item">
            <div class="my-drag-indicator">
                // style your line here
            </div>
            <div class="my-drag-content">
                // your content here
            </div>
        </div>
    </div>
    

    while dragging, you will have a clone image of your item, dragula will add 'gu-transit' class to it. As the structure above, you can style your .draggable-item.gu-transit to hide the '.my-drag-content' and show the 'my-drag-indicator'