ngx-drag-drop icon indicating copy to clipboard operation
ngx-drag-drop copied to clipboard

Don't show placeholder when hovering draggable source item

Open nico281 opened this issue 6 years ago • 5 comments

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

nico281 avatar Apr 19 '18 15:04 nico281

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 😃

reppners avatar Apr 19 '18 18:04 reppners

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

nico281 avatar Apr 19 '18 19:04 nico281

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.

reppners avatar Apr 20 '18 09:04 reppners

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.

nico281 avatar Apr 20 '18 12:04 nico281

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

  • the current drop index/position of a dragged item is equal to the original index/position
  • the dragged item is originally inside the same drop zone that is currently dragged over

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.

reppners avatar Apr 20 '18 13:04 reppners

Stale issue.

ChristofFritz avatar Apr 12 '23 12:04 ChristofFritz