reppners / ngx-drag-drop

Angular directives using the native HTML Drag And Drop API
https://reppners.github.io/ngx-drag-drop/
BSD 3-Clause "New" or "Revised" License
311 stars 121 forks source link

Custom drag image #168

Open guoliang opened 5 months ago

guoliang commented 5 months ago

Is your feature request related to a problem? Please describe. It's not per say related, but I think if possible maybe it would resolve https://github.com/reppners/ngx-drag-drop/issues/110

Currently this library don't support creating a drag element on the fly I think?

Since when I looked in here https://github.com/reppners/ngx-drag-drop/blob/280b10c71c78aec812e76fe1a241d2035547f5aa/projects/dnd/src/lib/dnd-draggable.directive.ts#L238-L245

It seems it is either the dragged element, or the custom element annotated with dndDragImageElementRef used as the dragging element. According to https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage it should be possible to create an image element, and set it as the dragged element with setDragImage

Describe the solution you'd like Possibility to supply parameters to have an image element created, wherein it is used as the dragged element.

adam-drozdz-ie commented 5 months ago

Hello, did you resolve this somehow? I also think that it'd be useful to be able to create a custom drag image.

guoliang commented 5 months ago

Hello, did you resolve this somehow? I also think that it'd be useful to be able to create a custom drag image.

I haven't. I'm just using what's possible atm.