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
307 stars 120 forks source link

Don't show placeholder when hovering draggable source item #11

Closed nico281 closed 1 year ago

nico281 commented 6 years ago

Hi, how are you? I have a question regarding the drag effect. When you start to drag an item, the item continue being visible and gives the illusion of having an additional item on the list. the same is with only one item, you have the effect of drop on top or below the same item you started to grab. do you think is a good behavior? i think it could be a behavior bug. Cheers

reppners commented 6 years ago

Hi, I'm good thanks :) I hope you're well, too!

The library does not provide any strategy or behavior for how draggable source nodes should by styled while they're dragged. Library users can use the input property of the dndDraggable directive

// set a custom class that is applied to only the src element while dragging
dndDraggingSourceClass: string = "dndDraggingSource";

to set a custom class or use the default class to define styling according to their application requirements.

The demos feature some lists with movable items where you're definitely right that it feels awkward having the item that is dragged staying visible in the list without a visual cue that it will disappear on successful drop. The demos could be improved with some additional css styling. PRs welcome 😃

nico281 commented 6 years ago

Thx for your response my friend!! The thing a don´t understand is the dndPlaceholderRef. you need to use it to get access to the event id and that´s the responsible to the awkward behave. i will share a picture pic

reppners commented 6 years ago

You need the element with dndPlaceholderRef only when you want to implement a sortable list. On drop you will get the index in the drop event so your logic can insert it at the right position. You can also style the dndPlaceholderRef element any way you want it to look. Or not use it at all. The only consequence will be that it will not be sortable.

nico281 commented 6 years ago

the thing is that i want to change the behavior of the dndPlaceholderRef. You use a div to move across the list to reference the drop place. but if you have one element for example and try to move that element that div appears or on top or below that single element and i want only to appear if you pass over another element for example.

reppners commented 6 years ago

I think I got you now 😁

Let me rephrase your requirements to make sure we're on the same page.


Don't show the dndPlaceholderRef when all of the following conditions are true


That's very valid point and would be a good enhancement but it may not be super easy to implement.

PRs or ideas for how to implement welcome :) Can't promise any timeframe to get this implemented as I'm rather busy at the moment.

ChristofFritz commented 1 year ago

Stale issue.